Zoom SDK initialize failed when running the sample project

I download the Android SDK of version [v5.0.24437.0708]. When running the sample project, I past the generated JWT from [https://jwt.io/#libraries-io] webside with below paylaod:
{
“appKey”: “string”, // sdk key
“iat”: long, // access token issue timestamp
“exp”: long, // access token expire time
“tokenExp”: long // token expire time
}
It always raise error onZoomSDKInitializeResult, errorCode=1, internalErrorCode=0

What should i do to fix it?

Hi @henry1,

Thanks for using Zoom SDK. Based on the error code, it seems like the JWT token is invalid. Could you provide a sample of your payload(without the appKey)?

Thanks!

Hi, Carson:
I used below payload:
{
“appKey”: “string”//SDK key
“iat”: 1597028327962, //milliseconds. System.currentTimeMillis()
“exp”: 1597114727962, //milliseconds.System.currentTimeMillis()+2460601000
“tokenExp”: 1597114727962 //milliseconds.System.currentTimeMillis()+24
60601000
}

BTW, I also tried to calculate the JWT from java codes with io.jsonwebtoken.Jwts. But, I found the result is different from the one i generated from [https://jwt.io/#libraries-io] with same input. Pls advise it. See below codes in java

public static void main(String args)throws Exception{
long timestamp = System.currentTimeMillis();
Date(2020,8,7).getTime();
System.out.println(timestamp);
System.out.println(timestamp+246060*1000);
Map<String, Object> header = new HashMap();
header.put(“alg”,“HS256”);
header.put(“typ”, “JWT”);
Map<String, Object> payload = new HashMap();
payload.put(“appKey”, _SDK_KEY);
payload.put(“iat”, timestamp);
payload.put(“exp”, timestamp);
payload.put(“tokenExp”, timestamp);
//SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64URL.decode(_SDK_SEC));
SecretKey key = Keys.hmacShaKeyFor(_SDK_SEC.getBytes(StandardCharsets.UTF_8));
String token = Jwts.builder().setHeader(header).setClaims(payload).signWith(key, SignatureAlgorithm.HS256)
.compact();

System.out.println(token);

}

May I know what is the encoding format of the generated SDK secret from zoom SDK app?

Hi @henry1,

Thanks for the reply and the code snippet. The timestamp in the JWT token should be in seconds, and the “exp” should be at most 48 hours from “iat” and the “tokenExp” should be at least 30 minutes from “iat”.

Please have a try. Thanks!

Hi Carson,
I have the same problem and I tried your solution but I still get the same error Failed to initialize zoom SDK Error:1, InternalErrorCode = 0
this is my payload:
{
“appKey”: “SDK_KEY”,
“iat”: 1599215 ,
“exp”: 1599350 ,
“tokenExp”: 3600
}

Hi @huda.anwar94, thanks for the post.

The issue appears to be with your values being some point in January of 1970. For reference, current epoch time as I am writing this response is 1599236975. The tokenExp value should be in epoch time as well.

Thanks!

Hi @jon.lieblich,
Thanks for replying I converted the time from milliseconds to seconds it’s today’s date but in seconds I will try it again in milliseconds.

Thanks

Hey @apresence,

Thanks!

Michael