Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SSO Login for Freshdesk support portal - PHP Sample Code (Updated)
<?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,
], '' , '&amp;');
}
header("Location: " . getSSOUrl("User's Name","username@thecompany.com"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.