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

**URL:** <https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571>\
**Category:** API and Webhooks\
**Created:** [September 17, 2020, 12:59pm UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571 "2020-09-17T12:59:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tushar.hoh](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@tushar.hoh](https://devforum.zoom.us/u/tushar.hoh)\
**Post date:** [September 17, 2020, 12:59pm UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571/1 "2020-09-17T12:59:38Z")

</div>

**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.

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [September 17, 2020, 1:00pm UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571/2 "2020-09-17T13:00:05Z")

</div>

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. 🙂

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

> [@JWT App for creating meetings](https://devforum.zoom.us/t/-/9452):
>
> Description Can I use a JWT app to create meetings for multiple app users or do I have to create a oAuth app? Error The full error message or issue you are running into. Which App Type (OAuth / Chatbot / JWT / Webhook)? JWT Which Endpoint/s? Create meetings

> [@How to create JWT token using REST api in c#](https://devforum.zoom.us/t/-/6620):
>
> Hi, how to create JWT token using REST api in c#

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

---

<div class="post-metadata">

**Author:** ![tushar.hoh](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@tushar.hoh](https://devforum.zoom.us/u/tushar.hoh)\
**Post date:** [September 17, 2020, 1:03pm UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571/3 "2020-09-17T13:03:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 18, 2020, 5:14pm UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571/4 "2020-09-18T17:14:07Z")

</div>

Hey @tushar.hoh,

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

> **[JSON Web Tokens (JWT) - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/auth/jwt)**
>
> JWT With Zoom
> 
> The Zoom API uses JSON Web Tokens (JWT) to authenticate account-level access. These tokens offer a method to establish secure server-to-s...

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [October 19, 2020, 3:14am UTC](https://devforum.zoom.us/t/im-creating-jwt-after-creating-jwt-getting-api-error/30571/5 "2020-10-19T03:14:19Z")

</div>

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