Created
August 2, 2017 19:04
-
-
Save joshuawoodward/7574df3df9a089e2663582a2cf9f188b to your computer and use it in GitHub Desktop.
How to generate a signature for zoom in PHP
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
/** | |
* Generate signature for ZoomMtg JSSDK. | |
* | |
* @param string $api_key You REST API Key | |
* @param string $api_secret You REST API Secret | |
* @param int $meeting_number The meeting number you are creating the signature for | |
* @param int $role Role that this signature is for; 0 for participant, 1 for host | |
* | |
* @return string Returns the signature string | |
* | |
*/ | |
function generate_signature ( $api_key, $api_sercet, $meeting_number, $role){ | |
$time = time() * 1000; //time in milliseconds (or close enough) | |
$data = base64_encode($api_key . $meeting_number . $time . $role); | |
$hash = hash_hmac('sha256', $data, $api_sercet, true); | |
$_sig = $api_key . "." . $meeting_number . "." . $time . "." . $role . "." . base64_encode($hash); | |
//return signature, url safe base64 encoded | |
return rtrim(strtr(base64_encode($_sig), '+/', '-_'), '='); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
but it is generating wrong signature