Forked from thanashyam/sso_login_freshdesk.php
Last active
September 5, 2018 10:13
-
-
Save AlLoud/cfdea1aac2d158f288deaa71ed186037 to your computer and use it in GitHub Desktop.
SSO Login for Freshdesk support portal - PHP Sample Code (Updated)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('FRESHDESK_SHARED_SECRET','____Place your Single Sign On Shared Secret here_____'); | |
define('FRESHDESK_LOGIN_URL','http://{{your-account}}.freshdesk.com/login/sso/'); | |
function getSSOUrl($strName, $strEmail) { | |
$timestamp = time(); | |
$str_to_be_hashed = $strName . FRESHDESK_SHARED_SECRET . $strEmail . $timestamp; | |
return FRESHDESK_LOGIN_URL . '?' . | |
http_build_query([ // parameters urlencoded by default - www.faqs.org/rfcs/rfc1738.html | |
'name' => $strName, | |
'hash' => hash_hmac('md5', $str_to_be_hashed, FRESHDESK_SHARED_SECRET)), | |
'email' => $strEmail, | |
'timestamp' => $timestamp, | |
], '' , '&'); | |
} | |
header("Location: " . getSSOUrl("User's Name","[email protected]")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment