Created
November 12, 2012 23:40
-
-
Save sbkinney/4062834 to your computer and use it in GitHub Desktop.
Example PHP script for SSO for Zendesk
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
<? | |
/* | |
* Remote authentication stub for PHP | |
* | |
* This is meant as a template for your own customization. You can identify the user anyway you like, | |
* integrate it into your intranet, web app or similar. | |
* | |
* You may call this script directly or have Zendesk redirect to it using the | |
* Remote Authentication URL. | |
* | |
*/ | |
/* The following values should be set from your source of information */ | |
$sFullName = "Name"; | |
$sEmail = "[email protected]"; | |
$sExternalID = ""; | |
$sOrganization = ""; | |
$sTags = ""; | |
$sRemotePhotoURL = ""; | |
$sReturnTo = ""; | |
/* Insert the Autentication Token here */ | |
$sToken = ""; | |
/* Insert your account prefix here. If your account is yoursite.zendesk.com: */ | |
$sUrlPrefix = "yoursite"; | |
/* Build the message */ | |
$sTimestamp = isset($_GET['timestamp']) ? $_GET['timestamp'] : time(); | |
$sMessage = $sFullName."|".$sEmail."|".$sExternalID."|".$sOrganization."|".$sTags."|".$sRemotePhotoURL."|".$sToken."|".$sTimestamp; | |
$sHash = MD5($sMessage); | |
$sso_url = "https://".$sUrlPrefix.".zendesk.com/access/remoteauth/?name=".$sFullName."&email=".$sEmail."&external_id=".$sExternalID."×tamp=".$sTimestamp."&hash=".$sHash."&return_to=".$sReturnTo; | |
header("Location: ".$sso_url); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You forgot to add the organization parameter n the sso_url.