# How can I check JWT

**URL:** <https://community.auth0.com/t/how-can-i-check-jwt/83894>\
**Category:** Get Help\
**Created:** [May 22, 2022, 1:56pm UTC](https://community.auth0.com/t/how-can-i-check-jwt/83894 "2022-05-22T13:56:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gal1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gal1/32/33850_2.png) [@gal1](https://community.auth0.com/u/gal1)\
**Post date:** [May 22, 2022, 1:56pm UTC](https://community.auth0.com/t/how-can-i-check-jwt/83894/1 "2022-05-22T13:56:21Z")

</div>

Hi all,  
my company develop react native application.  
We also develop the backend in Nodejs.  
react native need to make some private API.  
for that after login I get JWT.  
How can I verify that JWT is OK?  
I tried to read pen file and call verify method. but it always fail.

example code :

const cert = fs.readFileSync(“a.pem”);  
const token = data;  
console.log(cert);  
const res = await jwt.verify(token.toString(), cert);

I get invalid signature always.  
What seems to be a problem.

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [May 23, 2022, 4:49pm UTC](https://community.auth0.com/t/how-can-i-check-jwt/83894/3 "2022-05-23T16:49:39Z")

</div>

Hi @gal1 ,

Thank you for posting this topic on the Auth0 Community!

`How can I verify that JWT is OK?`

**Answer** : [This](https://auth0.com/docs/secure/tokens/json-web-tokens/validate-json-web-tokens) article explains how to verify JSON Web Token. And [this](https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback) article explains the jw.verify() function with sample code.

`I tried to read pen file and call verify method. but it always fails.`

Could you please confirm if the token is valid if verifying it in [https://jwt.io/](https://jwt.io/), and check if the token and the secretOrPublicKey passed to your function are valid?

Also, I found two articles in our community regarding the same error. The details in the articles might help solve the error.

> [@Why does jwt.verify() give "invalid signature"?](https://community.auth0.com/t/why-does-jwt-verify-give-invalid-signature/16701):
>
> In the [JWT.io](http://JWT.io) debugger it says it is verified.

> [@Unable to verify jwt generated by auth0](https://community.auth0.com/t/unable-to-verify-jwt-generated-by-auth0/6070):
>
> Hi! I am having trouble with implementing a client-credentials flow used by a webtask script, and would really appreciate some help. I am able to get an access\_token use the cURL command provided in the Quick Start page in my client as such: curl --request POST \ --url https://\*\*\*\*\*.auth0.com/oauth/token \ --header 'content-type: application/json' \ --data '{"client\_id":"CXG6bVUbm\*\*\*\*\*\*PqbQOlGdlYx","client\_secret":"{AUTH0\_CLIENT\_SECRET}","audience":"https://cmd-list","grant\_type":"client…

If you need further assistance, please provide more context, and I will look into this further. Thank you!

---

<div class="post-metadata">

**Author:** ![lihua.zhang](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lihua.zhang/32/39683_2.png) [@lihua.zhang](https://community.auth0.com/u/lihua.zhang)\
**Post date:** [February 2, 2023, 5:15pm UTC](https://community.auth0.com/t/how-can-i-check-jwt/83894/4 "2023-02-02T17:15:19Z")

</div>


