# JWT Token is Invalid

**URL:** <https://devforum.zoom.us/t/jwt-token-is-invalid/67406>\
**Category:** Authentication\
**Created:** [April 11, 2022, 7:40pm UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406 "2022-04-11T19:40:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dulcevidaglutenfree](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dulcevidaglutenfree/32/36802_2.png) [@dulcevidaglutenfree](https://devforum.zoom.us/u/dulcevidaglutenfree)\
**Post date:** [April 11, 2022, 7:40pm UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406/1 "2022-04-11T19:40:38Z")

</div>

I’m using Nowakowskir adhocore JWT PHP library from [JWT.io](http://JWT.io) to generate the token:  
[GitHub - adhocore/php-jwt: Ultra lightweight, dependency free and standalone JSON web token (JWT) library for PHP5.6 to PHP8.0. This library makes JWT a cheese.](https://github.com/adhocore/php-jwt)

```auto
$header = array();
		$header['alg'] = 'HS256';
		$header['typ'] = 'JWT';
		
		$pload = array();
		$pload['iss'] = API_KEY;
		$pload['exp'] = time() + 3600;
		$tokenDec = new Nowakowskir\JWT\TokenDecoded($header,$pload);
		
		$tokenEncoded = $tokenDec->encode(API_SECRET,'HS256');
		return $tokenEncoded->toString();

```

The Token apparently generates fine, but when trying to establish an API connection I get an error that the token its Invalid.  
{“code”:124,“message”:“Invalid access token.”}

Any idea where its going wrong?  
Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 12, 2022, 1:53pm UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406/2 "2022-04-12T13:53:40Z")

</div>

Hi!

Thanks for reaching out!  
Have you tried debugging your JTW token to make sure it is valid?  
You can debug it here:

> **[JWT.IO](https://jwt.io/)**
>
> JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.

Here is the link to our Docs:

> **[JWT With Zoom](https://marketplace.zoom.us/docs/guides/auth/jwt/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

Hope this helps  
Elisa

---

<div class="post-metadata">

**Author:** ![dulcevidaglutenfree](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dulcevidaglutenfree/32/36802_2.png) [@dulcevidaglutenfree](https://devforum.zoom.us/u/dulcevidaglutenfree)\
**Post date:** [April 12, 2022, 3:41pm UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406/3 "2022-04-12T15:41:16Z")

</div>

Thanks. Tried using a different Library (Acc/Jwt) and it worked fine. Seems like the Nowakowskir library has some kind of issue during generation.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 13, 2022, 5:07pm UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406/4 "2022-04-13T17:07:29Z")

</div>

Happy to hear you solved this issue!  
Let me know if there is anything else you need from us!  
Cheers,  
Elisa 🙂

---

<div class="post-metadata">

**Author:** ![nowrad](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@nowrad](https://devforum.zoom.us/u/nowrad)\
**Post date:** [January 30, 2023, 9:00am UTC](https://devforum.zoom.us/t/jwt-token-is-invalid/67406/5 "2023-01-30T09:00:29Z")

</div>

@dulcevidaglutenfree I think that’s because you missed the order or parameters. You passed header as a payload, and payload as a header.  
Here is a link to the documentation of this library: [GitHub - nowakowskir/php-jwt: JSON Web Tokens (JWT) implementation for PHP 7.](https://github.com/nowakowskir/php-jwt#building-the-new-jwt)  
Best,  
Rad
