My backend the PHP and I have added a logic to implement webhook with my URL. But webhook is not able to validate.
Below is my code. Here I have hide my secret. My both the variables are matching encryptedToken and ZoomSignature. Please guide me further.
$secret = “This is removed for security purpose”;
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’){
$data = file_get_contents(“php://input”);
$webinar_array = json_decode($data);
// $GLOBALS[‘log’]->fatal(“webinar_array=”.print_r($webinar_array,1));
$string = $webinar_array->payload->plainToken;
$timestamp = $_SERVER[‘HTTP_X_ZM_REQUEST_TIMESTAMP’];
$message = "v0:".$timestamp.":".$data;
$GLOBALS['log']->fatal("message=".$message);
$encryptedToken = hash_hmac('sha256', $message, $secret);
$encryptedToken = "v0=".$encryptedToken;
$ZoomSignature = $_SERVER['HTTP_X_ZM_SIGNATURE'];
// $GLOBALS['log']->fatal("server=".print_r($_SERVER,1));
// Response HTTP status code when:
// 200: Correctly signed payload
// 401: Incorrectly signed payload
// if (hash_equals($encryptedToken, $ZoomSignature)) {
if ($encryptedToken == $ZoomSignature) {
http_response_code(200);
} else {
http_response_code(401);
}
return true;
}