I am trying to integrate Zoom meeting SDK into a Wordpress website, I setup this auth endpoint on the server: GitHub - zoom/meetingsdk-auth-endpoint-sample: Generate a Meeting SDK JWT to join Zoom meetings and webinars with the Meeting SDK., and everything is working as expected, the question is: is there any alternative auth endpoint built with PHP or any documentation for integrating the auth API with any programming language?
@Kinan ,
if you want to code this in PHP, you could do something like this
<?php
$config = include 'config.php';
$meetingSDKClientKey = $config['meetingSDKClientKey'];
$meetingSDKClientSecret = $config['meetingSDKClientSecret'];
$iat = time() - 30;
$exp = $iat + 60 * 60 * 10;
//$client_request = $this->request->input('json_decode');
// Define the payload data for your JWT token
$token_payload = [
'sdkKey' => $meetingSDKClientKey,
'mn' => 9898533313,
'role' => 1,
'iat' => $iat, // Issued at timestamp
'exp' => $exp, // Expiration timestamp (2 hours from now)
'appKey' => $meetingSDKClientKey,
'tokenExp' => $exp
];
// Encode the JWT token
$header = json_encode(['typ' => 'JWT', 'alg' => 'HS256']);
$payload = json_encode($token_payload);
$headers_encoded = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header));
$payload_encoded = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload));
$signature = hash_hmac('sha256', $headers_encoded . '.' . $payload_encoded, $meetingSDKClientSecret, true);
$signature_encoded = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($signature));
$jwt = $headers_encoded . '.' . $payload_encoded . '.' . $signature_encoded;
echo $jwt;
?>