# Auth0.js V9 returns invalid token altrough user info are parsed correctly

**URL:** <https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [January 28, 2023, 1:27pm UTC](https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204 "2023-01-28T13:27:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![giovannilaperna](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/giovannilaperna/32/34414_2.png) [@giovannilaperna](https://community.auth0.com/u/giovannilaperna)\
**Post date:** [January 28, 2023, 1:27pm UTC](https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204/1 "2023-01-28T13:27:20Z")

</div>

I’ve an application with custom gateway passwordless connection and RS256 JSON Web Token (JWT) Signature Algorithm  
On my application I’m authenticatin with Classic Universal Login Experience correctly. I get a valid token  
I’m now trying to migrate to auth0.js V9 and I get something unexpected:  
the user info is parsed correcly however the accessToken is invalid

This function correclty log the user info

```auto
webAuth.parseHash({ hash }, function(err, authResult) {
  if (err) {
    return console.log('err', err);
  }
  webAuth.client.userInfo(authResult.accessToken, function(err, user) {
    if (err) {
      console.log('err', err)
    }
    else {
      console.log('user', user)
    }
  })
})

```

this function logs the error `jwt malformed`

```auto
import jwt from 'jsonwebtoken'

jwt.verify(token, process.env.AUTH0_SIGNING_CERTIFICATE, { algorithms: ['RS256'] }, (err, decoded) => {
  if (err) {
    console.log('err', err)
  }
  else {
    console.log('decoded', decoded)
  }
})

```

and if I check the token on [jwt.io](http://jwt.io) I get `Invalid Signature`.

What can be the reason?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 31, 2023, 3:27pm UTC](https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204/3 "2023-01-31T15:27:42Z")

</div>

Hi @giovannilaperna,

I would suggest starting with this FAQ:

[https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028](https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028)

---

<div class="post-metadata">

**Author:** ![giovannilaperna](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/giovannilaperna/32/34414_2.png) [@giovannilaperna](https://community.auth0.com/u/giovannilaperna)\
**Post date:** [January 31, 2023, 6:26pm UTC](https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204/4 "2023-01-31T18:26:46Z")

</div>

Thank you!  
Resolved setting the `audience` property.

---

<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:** [February 14, 2023, 6:26pm UTC](https://community.auth0.com/t/auth0-js-v9-returns-invalid-token-altrough-user-info-are-parsed-correctly/99204/5 "2023-02-14T18:26:57Z")

</div>

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