Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWTClaimsError('Invalid audience') #88

Closed
casoetan opened this issue Dec 14, 2021 · 0 comments · Fixed by #92
Closed

JWTClaimsError('Invalid audience') #88

casoetan opened this issue Dec 14, 2021 · 0 comments · Fixed by #92
Labels
bug Something isn't working

Comments

@casoetan
Copy link

Describe the bug

Using Auth0 and the example application. I notice the accessToken generated cannot be used for to make external API calls to a different backend service verifying tokens with Auth0. The decoded jwt token's aud doesn't match the expected aud. The error returned is JWTClaimsError('Invalid audience').

I haven't dug deep into why, but maybe when setting the strategy, you should allow setting the audience. See

authenticator.use(
  new Auth0Strategy(
    {
      callbackURL: process.env.AUTH0_CALLBACK_URL,
      clientID: process.env.AUTH0_CLIENT_ID,
      clientSecret: process.env.AUTH0_CLIENT_SECRET,
      domain: process.env.AUTH0_DOMAIN,
      scope: process.env.AUTH0_SCOPES,

      audience: process.env.AUTH0_AUDIENCE,  // this may be the fix. :)
    },
...

Your Example Website or App

NA

Steps to Reproduce the Bug or Issue

Expected behavior

Token should be valid

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome

Additional context

No response

@sergiodxa sergiodxa added the bug Something isn't working label Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants