yrmallu Posted June 17 Share Posted June 17 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: 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. 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: WHMCS version: 8.10.1 PHP version: 8.1.2 I am looking forward to any guidance and assistance you can provide on this matter. Best Regards, 0 Quote Link to comment Share on other sites More sharing options...
Julien Posted June 17 Share Posted June 17 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. 0 Quote Link to comment Share on other sites More sharing options...
WhmTools Posted June 17 Share Posted June 17 Hello, Have you installed GuzzleHttp in your addon or using the Guzzlehttp coming along with whmcs? 0 Quote Link to comment Share on other sites More sharing options...
yrmallu Posted June 17 Author Share Posted June 17 Hi, I have installed Auth0 PHP SDK version 8.2 and it's installed all its dependencies. I didn't install GuzzleHttp externally. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.