Hi,
I’m using the Zoom Web SDK to join/start meetings and I’m seeing a strange behavior where a user who should be the host sometimes joins as a participant instead — and it happens randomly.
(zoom/meetingsdk: “^3.13.2”)
According to the docs:
role
:0
specifies participant,1
specifies host.
Here’s an example of the data I send before generating the JWT token:
{
meetingNumber: "12132526369",
role: 0,
zoomPassword: "1234",
userName: "John Doe",
userEmail: "john.doe@example.com"
}
{
meetingNumber: "12132526369",
role: 1,
zoomPassword: "1234",
userName: "Dr. Smith",
userEmail: "dr.smith@example.com"
}
This data is passed to my Zoom auth route to generate the JWT token exactly as the docs describe.
Zoom Auth Route:
try {
const iat = Math.round(new Date().getTime() / 1000) - 30;
const exp = iat + 60 * 60 * 2;
const oHeader = { alg: "HS256", typ: "JWT" };
const oPayload = {
sdkKey: clientId,
appKey: clientId,
mn: meetingNumber,
role: role,
iat: iat,
exp: exp,
tokenExp: iat + 60 * 60 * 2,
};
console.log(oPayload, "oPayload");
const sHeader = JSON.stringify(oHeader);
const sPayload = JSON.stringify(oPayload);
const signature = KJUR.jws.JWS.sign(
"HS256",
sHeader,
sPayload,
clientSecret
);
return NextResponse.json({
signature,
});
} catch (err) {
return NextResponse.json({ err });
}
With the generated JWT, the meeting is joined via:
content.js (simplified snippet):
const startMeeting = () => {
document.getElementById("zmmtg-root").style.display = "block";
setLoading(false);
ZoomMtg.init({
leaveUrl: currentDomainData.origin,
patchJsMedia: true,
success: (success) => {
console.log(success);
ZoomMtg.join({
signature,
sdkKey,
meetingNumber,
passWord,
userName,
userEmail,
tk: "",
zak: "",
success: (success) => {
console.log(success);
},
error: (error) => {
console.log(error);
},
});
},
error: (error) => {
console.log(error);
},
});
};
The implementation works most of the time, but randomly, the user that should be the host (role 1
) joins as a participant instead.
Has anyone seen this before or knows what might cause Zoom to ignore the role: 1
in the JWT payload? Could it be related to ZAK tokens, meeting state, or host already being in the meeting?
Thanks in advance.