How can I check JWT

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.

Hi @gal1 ,

Thank you for posting this topic on the Auth0 Community!

How can I verify that JWT is OK?

Answer: This article explains how to verify JSON Web Token. And this 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/, 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.

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