Invalid SDK KEY on Zoom Javascript SDK

Hello please am having an issue with my code
create_meetin.php (page)

<?php // Include the Firebase JWT PHP library require_once 'vendor/autoload.php'; // Make sure to adjust the path to your autoload file use \Firebase\JWT\JWT; // Replace with your Zoom Server-to-Server OAuth credentials define('CLIENT_ID', 'xxxxxxxx'); // Your Zoom Server-to-Server OAuth Client ID define('CLIENT_SECRET', 'xxxxxxx'); // Your Zoom Server-to-Server OAuth Client Secret define('ZOOM_EMAIL','virtualevents@myemail.com'); // Function to generate Server-to-Server OAuth access token function getAccessToken() { $url = 'https://zoom.us/oauth/token'; $payload = [ 'grant_type' => 'account_credentials', 'account_id' => '_QvcWxBfS7C6YNb4hX9HLA', // Replace with your actual account ID ]; $headers = [ 'Authorization: Basic ' . base64_encode(CLIENT_ID . ':' . CLIENT_SECRET), 'Content-Type: application/x-www-form-urlencoded', ]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $response = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('cURL Error: ' . curl_error($ch)); } curl_close($ch); $decodedResponse = json_decode($response, true); if (!isset($decodedResponse['access_token'])) { throw new Exception('Failed to generate access token: ' . $response); } return $decodedResponse['access_token']; } // Function to create a Zoom meeting function createZoomMeeting($topic, $start_time, $duration, $access_token) { $url = 'https://api.zoom.us/v2/users/' . ZOOM_EMAIL . '/meetings'; $headers = [ 'Authorization: Bearer ' . $access_token, 'Content-Type: application/json' ]; $postFields = json_encode([ 'topic' => $topic, 'type' => 2, // Scheduled meeting 'start_time' => $start_time, 'duration' => $duration, 'settings' => [ 'host_video' => true, 'participant_video' => true, 'join_before_host' => false, 'mute_upon_entry' => true, 'audio' => 'both', 'auto_recording' => 'cloud' ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $response = curl_exec($ch); if (curl_errno($ch)) { throw new Exception('cURL Error: ' . curl_error($ch)); } curl_close($ch); return json_decode($response, true); } // Function to generate SDK Signature using JWT function generateSDKSignature($sdkKey, $sdkSecret, $meetingNumber, $role) { $iat = time(); $exp = $iat + 60; // Signature valid for 60 seconds $payload = [ 'sdkKey' => $sdkKey, 'mn' => $meetingNumber, 'role' => $role, 'iat' => $iat, 'exp' => $exp, 'appKey' => $sdkKey, 'tokenExp' => $iat + 3600 // Token expiration ]; // Encode the payload and generate the JWT token $jwt = JWT::encode($payload, $sdkSecret, 'HS256'); // Add 'HS256' as the algorithm return $jwt; } // Main Script if ($_SERVER['REQUEST_METHOD'] === 'POST') { $topic = $_POST['topic']; $start_time = $_POST['start_time']; // ISO 8601 format $duration = $_POST['duration']; // Duration in minutes $role = 1; // 1 for host, 0 for participant try { // Step 1: Get Access Token $access_token = getAccessToken(); // Step 2: Create Zoom Meeting $meeting = createZoomMeeting($topic, $start_time, $duration, $access_token); if (isset($meeting['code'])) { throw new Exception("Error Creating Meeting: " . $meeting['message']); } // Step 3: Generate SDK Signature using JWT $sdkKey = CLIENT_ID; // Use Client ID as SDK Key $sdkSecret = CLIENT_SECRET; // Use Client Secret as SDK Secret $meetingNumber = $meeting['id']; $sdkSignature = generateSDKSignature($sdkKey, $sdkSecret, $meetingNumber, 0); // Return Response echo json_encode([ 'meeting' => $meeting, 'sdkSignature' => $sdkSignature, ]); } catch (Exception $e) { echo json_encode([ 'error' => $e->getMessage() ]); } } else { echo ' Topic:


Start Time (ISO 8601, e.g., "2025-01-08T10:00:00Z"):


Duration (minutes):


Create Meeting '; } ?>

the meeting details is created success but i have issue joining the meeting

Response
{“meeting”:{“uuid":“hWPlGoEvS4ytEkdSTNCWUQ==”,“id”:82366919918,“host_id”:“yz29o_yKT5mVFGuK1Wa5PQ”,“host_email”:"virtualevents@projkonnect.com”,“topic”:“Project Konnect Topics specials”,“type”:2,“status”:“waiting”,“start_time”:“2025-01-08T23:01:53Z”,“duration”:60,“timezone”:“America/New_York”,“created_at”:“2025-01-08T23:01:53Z”,“start_url”:“https://us06web.zoom.us/s/9700709395?zak=eyJ0eXAiOiJKV1QiLCJzdiI6IjAwMDAwMSIsInptX3NrbSI6InptX28ybSIsImFsZyI6IkhTMjU2In0.eyJpc3MiOiJ3ZWIiLCJjbHQiOjAsIm1udW0iOiI5NzAwNzA5Mzk1IiwiYXVkIjoiY2xpZW50c20iLCJ1aWQiOiJ5ejI5b195S1Q1bVZGR3VLMVdhNVBRIiwiemlkIjoiMzA4YjA1MWViM2JhNDg4NTk0OTEwZWMzMzUyZGRmOWQiLCJzayI6IjYyNzYxMDUzMzgxNzUxMTE5NjkiLCJzdHkiOjEwMCwid2NkIjoidXMwNiIsImV4cCI6MTczNjM4NDUxMywiaWF0IjoxNzM2Mzc3MzEzLCJhaWQiOiJfUXZjV3hCZlM3QzZZTmI0aFg5SExBIiwiY2lkIjoiIn0.eRkad_WznRjRCw-0hq1A4CCm9C4t6Sp1Yg1jdb7hVQQ”,“join_url”:“https://us06web.zoom.us/j/9700709395?pwd=bzF6NFVUdC9pREhJRXA4bjhhTXh4dz09&omn=82366919918”,“password”:“rdE5x1”,“h323_password”:“176768”,“pstn_password”:“176768”,“encrypted_password”:“bzF6NFVUdC9pREhJRXA4bjhhTXh4dz09”,“pmi”:“9700709395”,“settings”:{“host_video”:true,“participant_video”:true,“cn_meeting”:false,“in_meeting”:false,“join_before_host”:false,“jbh_time”:0,“mute_upon_entry”:true,“watermark”:false,“use_pmi”:true,“approval_type”:2,“audio”:“both”,“auto_recording”:“cloud”,“enforce_login”:true,“enforce_login_domains”:“”,“alternative_hosts”:“”,“alternative_host_update_polls”:false,“close_registration”:false,“show_share_button”:false,“allow_multiple_devices”:false,“registrants_confirmation_email”:true,“waiting_room”:false,“request_permission_to_unmute_participants”:false,“global_dial_in_countries”:[“US”],“global_dial_in_numbers”:[{“country_name”:“US”,“number”:“+1 564 217 2000”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 646 931 3860”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 669 444 9171”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“San Jose”,“number”:“+1 669 900 6833”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 689 278 1000”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 719 359 4580”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“New York”,“number”:“+1 929 436 2866”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 253 205 0468”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“Tacoma”,“number”:“+1 253 215 8782”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“Washington DC”,“number”:“+1 301 715 8592”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 305 224 1968”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 309 205 3325”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“Chicago”,“number”:“+1 312 626 6799”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“city”:“Houston”,“number”:“+1 346 248 7799”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 360 209 5623”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 386 347 5053”,“type”:“toll”,“country”:“US”},{“country_name”:“US”,“number”:“+1 507 473 4847”,“type”:“toll”,“country”:“US”}],“registrants_email_notification”:true,“meeting_authentication”:true,“authentication_option”:“signIn__QvcWxBfS7C6YNb4hX9HLA”,“authentication_name”:“Sign in to Zoom”,“authentication_domains”:“”,“encryption_type”:“enhanced_encryption”,“approved_or_denied_countries_or_regions”:{“enable”:false},“breakout_room”:{“enable”:false},“internal_meeting”:false,“continuous_meeting_chat”:{“enable”:false,“auto_add_invited_external_users”:false,“auto_add_meeting_participants”:false},“participant_focused_meeting”:false,“push_change_to_calendar”:false,“resources”:,“auto_start_meeting_summary”:false,“auto_start_ai_companion_questions”:false,“allow_host_control_participant_mute_state”:false,“alternative_hosts_email_notification”:true,“show_join_info”:false,“device_testing”:false,“focus_mode”:false,“meeting_invitees”:,“private_meeting”:false,“email_notification”:true,“host_save_video_order”:false,“sign_language_interpretation”:{“enable”:false},“email_in_attendee_report”:false},“supportGoLive”:false,“creation_source”:“open_api”,“pre_schedule”:false},“sdkSignature”:“eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZGtLZXkiOiJIaUlrMDNORlNYeTYwbmRYTTFoaVEiLCJtbiI6ODIzNjY5MTk5MTgsInJvbGUiOjAsImlhdCI6MTczNjM3NzMxMiwiZXhwIjoxNzM2Mzc3MzcyLCJhcHBLZXkiOiJIaUlrMDNORlNYeTYwbmRYTTFoaVEiLCJ0b2tlbkV4cCI6MTczNjM4MDkxMn0.t3A653BeL5wk1y-Uz13PwwTJjAwEMs0NJc3QcsMr89U”}

Now Joining the meeting
(Javascript)
ZoomMtg.preLoadWasm()
ZoomMtg.prepareWebSDK()

var signature=“eyJ0eXAiOiJKV1QiLCJzdiI6IjAwMDAwMSIsInptX3NrbSI6InptX28ybSIsImFsZyI6IkhTMjU2In0.eyJpc3MiOiJ3ZWIiLCJjbHQiOjAsIm1udW0iOiI5NzAwNzA5Mzk1IiwiYXVkIjoiY2xpZW50c20iLCJ1aWQiOiJ5ejI5b195S1Q1bVZGR3VLMVdhNVBRIiwiemlkIjoiMzA4YjA1MWViM2JhNDg4NTk0OTEwZWMzMzUyZGRmOWQiLCJzayI6IjYyNzYxMDUzMzgxNzUxMTE5NjkiLCJzdHkiOjEwMCwid2NkIjoidXMwNiIsImV4cCI6MTczNjM4NDUxMywiaWF0IjoxNzM2Mzc3MzEzLCJhaWQiOiJfUXZjV3hCZlM3QzZZTmI0aFg5SExBIiwiY2lkIjoiIn0.eRkad_WznRjRCw-0hq1A4CCm9C4t6Sp1Yg1jdb7hVQQ”
var sdkKey = “xxxxxxxx”
var meetingNumber = ‘84978319461’ // The meeting number returned from the Zoom API
var passWord = ‘xxx’ // Ensure this is correctly passed from your meeting creation response
var role = 0
var userName = ‘JavaScript’
var userEmail = ‘virtualevents@projkonnect.com’
var registrantToken = ‘’
var leaveUrl = ‘https://zoom.us
var zakToken = ‘’

function startMeeting() {
document.getElementById(‘zmmtg-root’).style.display = ‘block’

ZoomMtg.init({
leaveUrl: leaveUrl,
patchJsMedia: true,
leaveOnPageUnload: true,
success: (success) => {
console.log(success)
ZoomMtg.join({
signature: signature,
sdkKey: sdkKey, // Ensure this is the correct SDK Key
meetingNumber: meetingNumber,
passWord: passWord,
userName: userName,
userEmail: userEmail,
//tk: registrantToken,
zak: zakToken,
success: (success) => {
console.log(success)
},
error: (error) => {
console.log(error)
},
})
},
})
}

Thank you for posting in the Zoom Developer Forum. Can you provide more details about the behavior you are seeing and what you already tired to resolve it ?

Also, this post seems related and may help:

Hello Thanks for your response am using Server to Server Authentication and after i generated the signature i wanted to start the meeting using the JS SDK i keep getting Invalid SDK in my broswer console key even when i generated one on the zoom developer sdk page using my client id and client secret ID and the meeting ID too.

i dont know if there is anything more i need to do regarding this ?

I saw something regarding Zoom ISV partnership that i can embed zoom features into my application unless am a partner i don’t know how true this is i have watch the video and followed every step directly and still same issues please i will be waiting for your reponse

Hello greeting to your please any feedback on my case ?? the solution you recommended tried it already many times and it does not work

@virtualevents ,

Apologies for the delay—I was under the weather. I notice you’ve created a Server-to-Server Authentication, but I recommend creating a general app instead. Have you explored our sample apps? We offer both a sample authentication app and a JavaScript Zoom Meeting SDK app. These apps demonstrate the entire flow with proper separation of concerns, which makes troubleshooting JWT issues much easier.

You can input your SDK credentials and add the token manually, which helps isolate whether the issue lies in your token generation process.

Here’s the sample meeting app where you can verify if your generated token works. If the token functions in this sample app, it should work in your application as well.

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