I'm Creating JWT.After Creating JWT Getting api error

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.

Hey @tushar.hoh

Thanks for posting on the Zoom Devforum! I am still learning, but I will try my best to help answer your question. :slightly_smiling_face:

Checkout these related threads that may have the answer you are looking for:

If these threads did not help, please let us know by replying back here and someone from the Developer Relations team will get back to you shortly.

Thanks,
DeveloperBot

I need help related to how to create JWT token in android.Please provide some example

Hey @tushar.hoh,

Can you make sure you’re following the steps outlined here to generate your JWT?:

If you’d like to share the token you’ve generated that throws this error, I’m happy to help debug!
-Will

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