I was trying to incorporate SSO in Freshdesk with WHMCS, but because WHMCS requires passing a query parameter = access_token instead of using the Authorization header, this is what you need to do to make it work.
1. Reveal Authorization Header in .htaccess
2. Use your own oauth-intermediary.php where you take the header and send the query parameter that WHMCS is expecting
|
<?php //https://www.yousite.com/oauth/userinfo.php //https://www.yousite.com/oauth-intermediary.php header('Content-Type: application/json'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://www.youtsite.com/oauth/userinfo.php?access_token=".str_replace("Bearer ","",getallheaders()["Authorization"])); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); echo $server_output; curl_close ($ch); |
3. User your new https://www.yousite.com/oauth-intermediary.php as the new userinfo.php URL when requested