Jump to content

wambomango

New Member
  • Posts

    2
  • Joined

  • Last visited

About wambomango

wambomango's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Here's a summarized approach to achieve this: Custom API File Creation: Start by creating custom API actions by adding new PHP files in the includes/api/ directory of your WHMCS installation. Name these files according to the action you want to perform. Register Custom API Actions: To make sure these custom API actions are registered and can be called, you need to create a custom hook that registers these actions with WHMCS. This is necessary because WHMCS doesn’t automatically register actions just by placing them in the includes/api/ directory. Example of a Working Solution: <?php add_hook('AdminAreaPage', 1, function ($vars) { apiroles_checkGroupOrAdd(); apiroles_checkApiOrAdd(); }); function apiroles_checkGroupOrAdd() { $apiCatalogGroups = \WHMCS\Api\V1\Catalog::get()->getGroups(); if (!array_key_exists('GROUP_NAME', $apiCatalogGroups)) \WHMCS\Api\V1\Catalog::add([], ['GROUP_NAME' => array('name' => 'Custom Group')]); } function apiroles_checkApiOrAdd() { $apiCatalogActions = \WHMCS\Api\V1\Catalog::get()->getActions(); if (!array_key_exists('customapifunction', $apiCatalogActions)) { \WHMCS\Api\V1\Catalog::add(array('customapifunction' => array( 'group' => 'GROUP_NAME', 'name' => 'CustomApiName', 'default' => 0 ))); } } Explanation of the Code: The add_hook function is used to register a custom hook in WHMCS, which triggers on the AdminAreaPage event. apiroles_checkGroupOrAdd function checks if a specific API group exists; if not, it creates one. apiroles_checkApiOrAdd function registers new API actions (customapifunction) under the created group.
  2. this should be added in the Docs: https://docs.whmcs.com/system/authentication/openid-connect-development/#6-authenticate-the-user after a lot of search i was able to find this. Example: oauth/userinfo.php?access_token={access_token:} generatet from step 4: https://docs.whmcs.com/system/authentication/openid-connect-development/#4-exchange-code-for-the-access_token-value-and-the-id-token
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated