Video SDK JWT token invalid

Video SDK JWT token invalid:

I am using the React-demo of the Zoom Video SDK, version 1.5.5 and I get the error


Description
I have the following function to generate the JWT token. But when the token is used, the error above shows and the SDK does not start.

Browser Console Error

{
type: 'JOIN_MEETING_FAILED',
reason: 'Verify JWT failed',
errorCode: 200
}

Which Web Video SDK version?
Zoom Video SDK, version 1.5.5

Video SDK Code Snippets

generateVideoToken(
  sdkKey: string,
  sdkSecret: string,
  topic: string,
  passWord = '',
  userIdentity = '',
  sessionKey = '',
  roleType = 1
) {
  let signature = '';
  try {
    const iat = Math.round(new Date().getTime() / 1000);
    const exp = iat + 60 * 60 * 2;
    // Header
    const oHeader = { alg: 'HS256', typ: 'JWT' };
    // Payload
    const oPayload = {
      app_key: sdkKey,
      iat,
      exp,
      tpc: topic,
      pwd: passWord,
      user_identity: userIdentity,
      session_key: sessionKey,
      role_type: roleType // role = 1 for host, 0 for attendee; a host must first start a session for attendees to join
      // topic
    };
    const sHeader = JSON.stringify(oHeader);
    const sPayload = JSON.stringify(oPayload);
    signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkSecret);
  } catch (e) {
    console.error(e);
  }
  return signature;
}

Additional context
Please state what might be wrong here because this has been working for the past 6 months of usage, but the error just surfaced recently.

Hi, @monali.patel.

Have you verified your token with JWT.io? Also, here is a troubleshooting guide on Meeting SDK JWT, which you can refer to for troubleshooting the Video JWT as well.

Make sure to check that your computer clock is correct as well. I’ve seen developers encounter issues with JWT when their clock is incorrect.

Hi Donte

Thanks for your response. I did verification with JWT.io and received message like invalid signature
Although the data in the token is correct, as seen on the right-hand side of the picture, it doesn’t seem to be valid.

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