Jump to content

OAuth2 Integration


pRieStaKos

Recommended Posts

Hello,

I'm integrating a platform with our WHMCS and they require SSO integration via OAuth2 3-Legged Flow.

  • The platform requests services and each service requests a SSO connection with WHMCS, by providing an Entry URL, a Logout URL and OAuth configuration (Logout/Redirect URL) and generates Client ID and Secret.
  • From their documentation I got Authorization URL, Token URL, Logout/End Session URL, Client ID, Client Secret (from product settings).
  • From what I see I need to serve their platform as the Identity Provider and WHMCS as the Client that gives access to WHMCS for each platform client.
  • On our custom module for this integration, implemented league/oauth-client (I am on v7.10) and created files as this guide suggests to.
  • I tried using their configuration by triggering their Authorization URL, but I get the approve page and connection is not established. It's probably wrong as it needs to be the other way.
  • I created OpenID credentials from WHMCS and trigger WHMCS Authorization URL along with the other options and by providing /clientarea.php or module/addonname/oauth2/authorize.php as Redirect URL. When I try to trigger the connection from the third-party platform, I'm getting a login page (for WHMCS) and when I provide the user credentials, I am redirecting to the clientarea.php with code/state values, but not connected.
  • I tried /oauth/authorize.php from this guide and I'm redirecting to /oauth/clientarea.php with 404 error.

Any suggestions to follow the correct approach on this ?

I want to create the SSO/Oauth2 connection with the third-party platform and be able to connect as Client to WHMCS when a client clicks on the service's URL from the other platform.

Thank you in advance.

Edited by pRieStaKos
Link to comment
Share on other sites

  • 2 years later...

Hi,


am looking to implement Single Sign-On (SSO) in WHMCS with Auth0 serving as the Identity Provider (IdP) using OAuth 2.0 protocol. 

Can you please let me know how to achieve this?


Thanks

Link to comment
Share on other sites

@bear Thanks for your response.

I have seen but it's not working as expected.

When I install Auth0 PHP SDK it crashes the WHMCS app with following error.

 

Quote

[Wed Jun 12 19:39:30.707018 2024] [php:error] [pid 1358623] [client 192.168.80.237:56137] PHP Fatal error:  Uncaught Error: Class "WHMCS\\Utility\\ErrorManagement" not found in /var/www/html/whmcs/init.php:0\nStack trace:\n#0 /var/www/html/whmcs/index.php(0): unknown()\n#1 {main}\n  thrown in /var/www/html/whmcs/init.php on line 0

I have installed Auth0 PHP SDK on WHMCS root directory using composer as follows

 

Quote

composer require auth0/auth0-php


If you have implemented  SSO then can you please share some sample code how to implement this

 

Thanks in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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