Facing issue while Validating WebHook to my URL in PHP

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;

}

Hi @sam6
Thanks for reaching out to the Zoom Developer Forum and welcome to our community!
Sorry for the late reply here! I just wanted to check in with you to see if you were able to troubleshoot this on your end or if you need some assistance here!
Cheers,
Elisa

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.