Jump to content

Cliens side SSO


Valeriy

Recommended Posts

Hello. Could you please advice me regarding SSO for our clients.

According to https://docs.whmcs.com/WHMCS_Single_Sign-On_Developer_Guide we need:

1. The application requests an access token by sending its credentials to the OAuth Token API Endpoint

    It looks like we need to use CreateOAuthCredential  API call for this. https://developers.whmcs.com/api-reference/createoauthcredential/
    
    But we get the result "{"result":"error","message":"A valid grant type is required."}". Please advice the reason of it.
    Our code:

        http_build_query(
        array(
            'action' => 'CreateOAuthCredential',
            'username' => '*****',
            'password' => md5('*****'),
            'granttype' => 'single_sign_on',
            'scope' => 'clientarea:sso clientarea:billing_info clientarea:announcements',
            'serviceId' => '1',
            'description' => 'Billing and Announcements SSO',
            'responsetype' => 'json',
        )


2. If the application credentials check out, the WHMCS auth server will return an access token to the application
So I should get the result below like in example

"{
    "result": "success",
    "credentialId": "1",
    "clientIdentifier": "COMPANY-NAME.SQxOYrZOUTQC8YTkLQuQ0w==",
    "clientSecret": "60XScB\/W8zzxtciWlvX8+OoO4ZAQj8dNLeFIulRlYhDgksrSJd0Olv+X7wyoJEWEOpZ9IivCaySN7s+\/a++Tlg=="
}
"

3. The application then redirects the user to the Single Sign-On API Endpoint passing in the token and desired destination (scope)
We have not found any documentation regarding this. What is the Single Sign-On API Endpoint and how we should redirect the user? Please advice.

Thanks a lot.

Link to comment
Share on other sites

  • 1 month later...

Hi,

http_build_query(
        array(
           'action' => 'CreateOAuthCredential',
            'username' => 'username',
          'password' => 'password',
          'grantType' => 'single_sign_on',
          'scope' => 'clientarea:sso clientarea:billing_info clientarea:announcements',
           'serviceId' => '43',
           'description' => 'All',
           'responsetype' => 'json',
            'redirectUri' => 'url'
       )
    )

 

use grantType instead of granttype. ServiceId is required for single_sign_on grantType.

 

I got successfully clientIdentifier and clientSecret but after that where to find the Single Sign-On API Endpoint - has no clue.

I you still stuck at point 2, I can share the script.

Thanks

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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