Hi,
I am using web SDK to join a meeting and server-to-server OAuth for creating a meeting.
When joining the meeting I am passing the Role=1 in signature to join as host, but while joining meeting, it says
Joining meeting timeout
Signature is invalid.
With following error message
{
“method”: “join”,
“status”: false,
“result”: “Invalid signature.”,
“errorMessage”: “Signature is invalid.”,
“errorCode”: 3712
}
Function to get sdk signature
eg: meetingNumber = 87483833442, role = 1
const getMsdkSignature = asyncHandler(async (req, res) => {
const iat = Math.round(new Date().getTime() / 1000) - 30
const exp = iat + 60 * 60 * 2
const oHeader = { alg: 'HS256', typ: 'JWT' }
const oPayload = {
sdkKey: process.env.CLIENT_ID,
appKey: process.env.CLIENT_ID,
mn: +req.body.meetingNumber,
role: +req.body.role,
iat: iat,
exp: exp,
tokenExp: exp,
};
const sHeader = JSON.stringify(oHeader);
const sPayload = JSON.stringify(oPayload);
const signature = KJUR.jws.JWS.sign(
"HS256",
sHeader,
sPayload,
process.env.CLIENT_SECRET
);
res.json({
signature: signature,
});
});
Web sdk as client view
SDK version - 2.11.0
ZoomMtg.init({
leaveUrl: LEAVE_URL,
success: (success) => {
console.log(success)
ZoomMtg.join({
signature,
meetingNumber: +mn,
sdkKey: process.env.CLIENT_ID,
userName: "abcd",
passWord: pw,
success: (success) => {
console.log(success)
},
error: (error) => {
console.log('Error is....',error)
}
})
},
error: (error) => {
console.log(error)
}
})
May I know where I am going wrong.
Thanks.
EDIT:
After debugging issue, I found out that signature created is invalid by above getMsdkSignature function. When I decode it in jwt.io website, it says invalid signature. Whats the correct way to generate signature ?
Decoded token data
{
“sdkKey”: “63QyZ…”,
“appKey”: “63QyZ…”,
“mn”: “82376833897”,
“role”: 1,
“iat”: 1682775672,
“exp”: 1682782872,
“tokenExp”: 1682782872
}