-
-
Save Azhovan/a5d7f1dc5199f53e13609b3f4deabb54 to your computer and use it in GitHub Desktop.
Generating an API Signature - Kayako Developer Resources - Kayako Wiki
This file contains hidden or 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 | |
$apiKey = "apikey"; | |
$secretKey = "secretkey"; | |
// Generates a random string of ten digits | |
$salt = mt_rand(); | |
// Computes the signature by hashing the salt with the secret key as the key | |
$signature = hash_hmac('sha256', $salt, $secretKey, true); | |
// base64 encode... | |
$encodedSignature = base64_encode($signature); | |
// urlencode... | |
$encodedSignature = urlencode($encodedSignature); | |
echo "Voila! A signature: " . $encodedSignature; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment