Description
I am using zoom android sdk.I am using zoom api.It requires JWT token a after creating token getting error.Please let me know how create the JWT
Error
{
“code”: 124,
“message”: “Invalid access token.”
}
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
invitation
How To Reproduce (If applicable)
Steps to reproduce the behavior:
This is function for creating JWT
private String jsonwebtoken()
{
long time = System.currentTimeMillis()+3600000;
System.out.println("");
String header = "{\"alg\": \"HS256\", \"typ\": \"JWT\"}";
String payload = "{\"iss\": \"" + SDK_KEY + "\"" + ", \"exp\": " + String.valueOf(time) + "}";
// String payload = "{\"iss\": \"" + SDK_KEY + "\"" + ", \"exp\": " + String.valueOf(time) + ",\"iat\": \"1600263637\"}";
try {
String headerBase64Str = Base64.encodeToString(header.getBytes("utf-8"), Base64.NO_WRAP| Base64.NO_PADDING | Base64.URL_SAFE);
String payloadBase64Str = Base64.encodeToString(payload.getBytes("utf-8"), Base64.NO_WRAP| Base64.NO_PADDING | Base64.URL_SAFE);
final Mac mac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKeySpec = new SecretKeySpec(SDK_SECRET.getBytes(), "HmacSHA256");
mac.init(secretKeySpec);
byte[] digest = mac.doFinal((headerBase64Str + "." + payloadBase64Str).getBytes());
return headerBase64Str + "." + payloadBase64Str + "." + Base64.encodeToString(digest, Base64.NO_WRAP| Base64.NO_PADDING | Base64.URL_SAFE);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
}
return null;
}
Additional context
I using developer.zoom.sdk App Key and app secret for generating JWT key.