Web SDK "Joining meeting timeout" error popup at the front end, in the console output "Invalid signature." with status code 200

I’m getting the “Joining meeting timeout” error popup message in my Angular App where I have integrated Web SDK. When I monitored the request-response I could see “Invalid signature.” error message is returning from the url:
https://zoom.us/api/v1/wc/info?meetingNumbe

I created a JWT App, copied API Key and API Secret, and used in the Java code to generate the signature. The following is the code I’m using to generate the code.
try {
Mac hasher = Mac.getInstance(“HmacSHA256”);
String ts = Long.toString(System.currentTimeMillis() - 30000);
String msg = String.format("%s%s%s%d", ZOOM_API_KEY, courseSession.getMeetingNumber(), ts, 0);

  hasher.init(new SecretKeySpec(ZOOM_API_SECRET.getBytes(), "HmacSHA256"));

  String message = Base64.getEncoder().encodeToString(msg.getBytes());
  byte[] hash = hasher.doFinal(message.getBytes());

  String hashBase64Str = DatatypeConverter.printBase64Binary(hash);
  String tmpString = String
      .format("%s.%s.%s.%d.%s", ZOOM_API_KEY, courseSession.getMeetingNumber(), ts, 0,
          hashBase64Str);
  String encodedString = Base64.getEncoder().encodeToString(tmpString.getBytes());

  dto.setSignature(encodedString.replaceAll("\\=+$", ""));
} catch (Exception e) {
  log.warn("Failed to generate zoom key", e);
  throw new InvalidOperationException("Failed to generate zoom signature");
}

I even tried a signature generated through the node.js github project: zoom/websdk-sample-signature-node.js

Still same error.

The following is my angular code which tries to join the meeting.
joinMeeting(signature: string, apiKey: string, meetingNumber: string, passWord: string, userName: string) {
const leaveUrl = ‘/courses/detail/’ + this.courseId;

    ZoomMtg.setZoomJSLib('assets/js/@zoomus/websdk/dist/lib', '/av');
    ZoomMtg.preLoadWasm();
    ZoomMtg.prepareJssdk();
    ZoomMtg.init({
        leaveUrl,
        isSupportAV: true,
        success: () => {
            ZoomMtg.join({
                meetingNumber,
                passWord,
                userName,
                apiKey,
                signature,
                success: () => console.log('joined'),
                error: (res) => console.log(res)
            });
        }
    });
}

Could you please help me fix the issue.

Hey @thara.it,

Thank you for reaching out to the Zoom Developer Forum. First, I would make sure that you’re server is using a UTC timezone so that the timestamp is in sync with our servers. Also, make sure that you’re testing with the latest version of the Web SDK (1.9.1).

Looking at you code, it looks like you follow our Java example pretty closely but please see here to make sure there aren’t any issues with the code causing this:

We also have a Sample Angular App that I recommend using as a reference. You can compare your implementation with the sample to spot any potential issues.

If that doesn’t help, please send an email to developersupport@zoom.us with a link to this thread. In that email, please include an example of an invalid signature that is generated.

I’ll investigate the issue further from there. Let me know if that helps.

Thanks,
Max