Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Azhovan/a5d7f1dc5199f53e13609b3f4deabb54 to your computer and use it in GitHub Desktop.
Save Azhovan/a5d7f1dc5199f53e13609b3f4deabb54 to your computer and use it in GitHub Desktop.
Generating an API Signature - Kayako Developer Resources - Kayako Wiki
<?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