Jump to content

Help Needed with Custom WHMCS Auth0 SSO Integration


Recommended Posts

Dear WHMCS community,

I am trying to implement Single Sign-On (SSO) functionality between my existing application and WHMCS using Auth0 as an identity provider. To accomplish this, I have developed an addon module in WHMCS which uses the Auth0 PHP SDK acquired through Composer.

Despite following recommended steps and practices and conducting extensive troubleshooting, I continue to face challenges with implementing this feature.

Specifically, I am encountering the following issues:

  1. When calling $auth0->getUser(), I receive a null value. This suggests that there might be an issue with session handling, despite me taking measures to ensure PHP sessions are correctly configured and that session data should persist across requests.

  2. I am running into GuzzleHttp package compatibility issues, as evident by PHP errors related to GuzzleHttp. I have tried various solutions, including updating all Composer package dependencies to their latest versions and ensuring compatibility between package versions, but this issue persists.

 

[Mon Jun 17 04:15:53.547925 2024] [php:error] [pid 1402765] [client 192.168.80.237:58483] PHP Fatal error:  Declaration of GuzzleHttp\\Psr7\\Request::getRequestTarget() must be compatible with Psr\\Http\\Message\\RequestInterface::getRequestTarget(): string in /var/www/html/whmcs/vendor/guzzlehttp/psr7/src/Request.php on line 58
[Mon Jun 17 04:15:53.560576 2024] [php:notice] [pid 1402765] [client 192.168.80.237:58483] [WHMCS Application] ERROR: Whoops\\Exception\\ErrorException: Declaration of GuzzleHttp\\Psr7\\Request::getRequestTarget() must be compatible with Psr\\Http\\Message\\RequestInterface::getRequestTarget(): string in /var/www/html/whmcs/vendor/guzzlehttp/psr7/src/Request.php:58 Stack trace: #0 /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/Utility/Error/Run.php(0): WHMCS\\Utility\\Error\\Run->handleError() #1 [internal function]: WHMCS\\Utility\\Error\\Run->handleShutdown() #2 {main} {"exception":"[object] (Whoops\\\\Exception\\\\ErrorException(code: 64): Declaration of GuzzleHttp\\\\Psr7\\\\Request::getRequestTarget() must be compatible with Psr\\\\Http\\\\Message\\\\RequestInterface::getRequestTarget(): string at /var/www/html/whmcs/vendor/guzzlehttp/psr7/src/Request.php:58)"} []

Here is some more information about my environment:

  1. WHMCS version: 8.10.1
  2. PHP version: 8.1.2

I am looking forward to any guidance and assistance you can provide on this matter.

Best Regards,

Link to comment
Share on other sites

Hello : )

We did exactly this with Cloudflare Access for our admin using a custom WHMCS hook:



    if(defined('ADMINAREA') && ADMINAREA && isset($_COOKIE['CF_Authorization'])) {
        
        if (basename($_SERVER['SCRIPT_NAME']) == 'logout.php') {
            $auth = new WHMCS\Auth();
            $auth->logout();
            header('Location: /cdn-cgi/access/logout');
            exit;
        }
        
        if (<redacted> && ($data = get_query_vals("tbladmins", "id", array("email" => <redacted>)))) {
            $auth = new WHMCS\Auth();
            $auth->getInfobyID($data['id']);
            $auth->setSessionVars();
            $auth->processLogin();
        }
    }

I redacted some of our code but I hope this gives you an idea on how to proceed.

Thanks.

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