Where to get sdk_key and sdk_secret? It looks like we need to create SDK app type. But the only options I have is General app, Server-to-server Oauth and Webhook
Create a General App and enable Meeting SDK in the embed tab.
The SDK Key is Client ID
The SDK Secret is Client Secret
Hey @chunsiong.zoom !
Thank you for your reply!
We created General App and enabled Meeting SDK in the embed tab. The status of the app is Draft. But we’re trying to use Development mode.
Our project is a platform for tutors and students. So, both of them can join to the lesson with the help of Zoom. We need to make tutors as host and students as participants if possible so that they can start and join the meeting without us (admins).
Could you please take a look at our current implementation because we’re getting an error (below description) and tell us what we are doing wrong?
Can we use the general app for testing before publishing and using it in production?
Thanks in advance!
Below is current implementation.
We use API endpoint of Zoom for creating a meeting on BE:
$response = Http::withToken($accessToken)
->post($this->apiUrl . '/users/me/meetings', [
'topic' => $data['topic'],
'type' => 2, // Scheduled meeting
'start_time' => $startTimeUTC, // In 'YYYY-MM-DDTHH:MM:SSZ' format
'duration' => $data['duration'], // In minutes
'timezone' => 'UTC',
'settings' => [
'join_before_host' => true,
'host_video' => true,
'participant_video' => true,
'mute_upon_entry' => true,
],
]);
On FE we create a valid signature and try to join to the meeting using @zoom/meetingsdk/embedded. The version is in package.json: "@zoom/meetingsdk": "^3.9.0",
import ZoomMtgEmbedded from '@zoom/meetingsdk/embedded';
const [client, setClient] = useState<ReturnType<typeof ZoomMtgEmbedded.createClient> | null>(
null
);
useEffect(() => {
if (typeof window !== 'undefined') {
const newClient = ZoomMtgEmbedded.createClient();
setClient(newClient);
}
}, []);
const createMeeting = () => {
const meetingNumber = 82351497329;
const signature = generateSignature(
'Client ID',
'Client Secret',
meetingNumber.toString(),
isStudent ? 0 : 1
);
startMeeting(signature, meetingNumber.toString());
};
async function startMeeting(signature: string, meetingNumber: string) {
const meetingSDKElement = document.getElementById('meetingSDKElement')!;
try {
await client?.init({
zoomAppRoot: meetingSDKElement,
language: 'en-US',
patchJsMedia: true,
leaveOnPageUnload: true,
});
console.log('init');
console.log('signature', signature);
console.log('meetingNumber', meetingNumber);
await client?.join({
signature,
sdkKey: 'Client ID',
meetingNumber,
userName: isStudent ? (lesson.student_name as string) : (lesson.tutor_name as string),
password: 'NcX3a5',
});
console.log('joined successfully');
} catch (error) {
console.log(error);
}
}
here is signature: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzWjV5SndKU1NRYVZUY05ESUdSWVF3IiwibW4iOiI4MjM1MTQ5NzMyOSIsInJvbGUiOjAsImlhdCI6MTcyOTc2MTg1OSwiZXhwIjoxNzI5NzY5MDU5LCJ0b2tlbkV4cCI6MTcyOTc2OTA1OX0.gngbMSNwkC7AAYxcpHQvem1b5sLBlEUAusDJghM8QG4
here is meeting number: 82351497329
We got a following error:
{
"type": "JOIN_MEETING_FAILED",
"reason": "Fail to join the meeting.",
"errorCode": 200
}
Function for generating signature:
import { KJUR } from 'jsrsasign';
export function generateSignature(
sdkKey: string,
sdkSecret: string,
meetingNumber: string,
role: number
): string {
const iat = Math.floor(new Date().getTime() / 1000) - 30; // issue time
const exp = iat + 60 * 60 * 2; // expiration time (valid for 2 hours)
// Create the signature payload
const oHeader = { alg: 'HS256', typ: 'JWT' };
const oPayload = {
sdkKey: sdkKey,
mn: meetingNumber,
role: role,
iat: iat,
exp: exp,
tokenExp: exp,
};
// Encode the header, payload, and secret
const sHeader = JSON.stringify(oHeader);
const sPayload = JSON.stringify(oPayload);
// Create the signature
const signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkSecret);
return signature;
}
@kuatbek.k are you using the development client ID and client secret?
could you also capture the tracking ID for me to take a look?
on your browser console
- go to network tab
- under the request, look for the url which looks something like info?meetingNumber=…
- Under the response, look for the x-zm-trackingID and paste the tracking ID in clear text here.
Hey @chunsiong.zoom!
Yes we use client ID & client secret of development.
There is no such url in network tab but there is something like this: /info?apikey=
this is the tracking ID: v=2.0;clid=us05;rid=WEB_6a5ee6a2aeec12a766ce8e953b064ba4
this is new signature:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzWjV5SndKU1NRYVZUY05ESUdSWVF3IiwibW4iOiI4MjM1MTQ5NzMyOSIsInJvbGUiOjEsImlhdCI6MTcyOTg1OTUwMiwiZXhwIjoxNzI5ODY2NzAyLCJ0b2tlbkV4cCI6MTcyOTg2NjcwMn0.a6NpS97kePIfbdUCUbBntXdmslnLgC7GGAcwzT2j6OE
the meeting number is the same as above
yes, we use next js "next": "^13.0.7"
and the react version is "react": "18.2.0"
I have some concerns about properties like zak, tk, password (above in the code). Do we really need them? Maybe because of that we have this error with joining?
Also we cannot identify what exactly is wrong because of general error code - 200. And is there any other way of debugging it?
@chunsiong.zoom Could you please also provide with the link of sample code you use there to retrieve the result in image above?
@kuatbek.k try this out
I don’t use ZAK and tk for the time being.
Password is mandatory most of the time