# How do I verify an Auth0 JWT with Node.js \> Jose?

**URL:** <https://community.auth0.com/t/how-do-i-verify-an-auth0-jwt-with-node-js-jose/123078>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [December 14, 2023, 11:41am UTC](https://community.auth0.com/t/how-do-i-verify-an-auth0-jwt-with-node-js-jose/123078 "2023-12-14T11:41:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkrp1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@kkrp1](https://community.auth0.com/u/kkrp1)\
**Post date:** [December 14, 2023, 11:41am UTC](https://community.auth0.com/t/how-do-i-verify-an-auth0-jwt-with-node-js-jose/123078/1 "2023-12-14T11:41:56Z")

</div>

I’m struggling to understand what I need to do to verify my Auth0-provided JWT via Node.js and jose. Here’s what I have, taken from the [jose docs](https://github.com/panva/jose/blob/HEAD/docs/functions/jwt_verify.jwtVerify.md):

```auto
const {payload, protectedHeader} = await jose.jwtVerify(tkn, secret);

```

`tkn` is the JWT sent from my front-end to the back-end, while `secret` is the value of the “secret” field in the Auth0 dashboard under my application.

This generates an error that

> Key for the RS256 algorithm must be of type CryptoKey."

I read in Auth0 that JWTs of type RS256 must be validated with a private signing key. I’m not sure what this means, and since it also says that JWTs of type HS256 are instead validated with the secret, I changed my application to HS256 instead. Now when I try the above code I get:

> “alg” (Algorithm) Header Parameter value not allowed

What am I doing wrong here? JWT seems very complicated ☹

Thank you.

[UPDATE]

I have also read this guide, which says that to decode RS256 I need my public key. It advises that I can obtain this from application \> advanced settings \> certificates \> signed certificate \> public key. This field does not exist (at least for me).

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [December 15, 2023, 2:15am UTC](https://community.auth0.com/t/how-do-i-verify-an-auth0-jwt-with-node-js-jose/123078/3 "2023-12-15T02:15:34Z")

</div>

Hey there @kkrp1 !

It might be easier to use the [JWKS endpoint](https://auth0.com/docs/secure/tokens/json-web-tokens/json-web-key-sets) outlined at the bottom under “Usage with a public JSON Web Key Set hosted on a remote URL” in the `jwtVerify` [documentation](https://github.com/panva/jose/blob/HEAD/docs/functions/jwt_verify.jwtVerify.md). Something like:

```auto
const JWKS = createRemoteJWKSet(new URL('https://{YOUR_AUTH0_DOMAIN}/.well-known/jwks.json'))

const {payload} = await jwtVerify(jwt, JWKS, {
  issuer: '{YOUR_AUTH0_DOMAIN}/',
  audience: '{YOUR_AUDIENCE}',
})

console.log(payload)

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 29, 2023, 2:15am UTC](https://community.auth0.com/t/how-do-i-verify-an-auth0-jwt-with-node-js-jose/123078/4 "2023-12-29T02:15:37Z")

</div>

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