Hi team,
We are upgrading meeting SDK to.12.0
We followed zoom provided documentation(https://developers.zoom.us/docs/meeting-sdk/auth/#generate-the-sdk-jwt) for signature genration process.
Below are the sample payload details for signature genration:
headers:
{
“typ”: “JWT”,
“alg”: “HS256”
}
claims:
{
“tokenExp”: 1685099172,
“mn”: “88647018174”,
“role”: 1,
“sdkKey”: “uCVOcGqnTp3e1RWUG9IXCrhU5cZjQkS1oXE2”,
“appKey”: “uCVOcGqnTp3e1RWUG9IXCrhU5cZjQkS1oXE2”,
“exp”: 1685099172,
“iat”: 1685095572
}
Below is the signature that was generated for above payload:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbkV4cCI6MTY4NTA5OTE3MiwibW4iOiI4ODY0NzAxODE3NCIsInJvbGUiOjEsInNka0tleSI6InVDVk9jR3FuVHAzZTFSV1VHOUlYQ3JoVTVjWmpRa1Mxb1hFMiIsImFwcEtleSI6InVDVk9jR3FuVHAzZTFSV1VHOUlYQ3JoVTVjWmpRa1Mxb1hFMiIsImV4cCI6MTY4NTA5OTE3MiwiaWF0IjoxNjg1MDk1NTcyfQ.qRszNxeTNy5aq9lpt0HZLaaZuCI_TGfq7Z3cAnSvp0s
Below is the java code snippet for signature genration:
public String generateZoomMeetingSDKJWT(String meetingNumber, int role) {
long currentTimestamp = LocalDateTime.now().toInstant(ZoneOffset.UTC).getEpochSecond();
long jwtExpireTime = currentTimestamp + 3600;
Map<String, Object> headers = new HashMap<>();
headers.put("alg", "HS256");
headers.put("typ", "JWT");
Map<String, Object> claims = new HashMap<>();
claims.put("appKey", ZOOM_SDK_KEY);
claims.put("sdkKey", ZOOM_SDK_KEY);
claims.put("mn", meetingNumber);
claims.put("role", role);
claims.put("iat", currentTimestamp);
claims.put("exp", jwtExpireTime);
claims.put("tokenExp", jwtExpireTime);
String jwt = Jwts.builder()
.setHeader(headers)
.setClaims(claims)
.signWith(SignatureAlgorithm.HS256, ZOOM_SDK_SECRET)
.compact();
return jwt;
}
scenario-1:
we are getting “signature is invalid” error when iat, exp and tokenExp are provided in seconds. Attached is the screenshot for the same.
scenario-2:
we are getting “signature is expired” erro when iat, exp and tokenExp are provided in milliseconds. Attached is the screenshot for the same.
Could you please look into these issues and provide your inputs.
Please let me know if you need any more information.