My api is throwing 401 unauthorized when I log in

HI When I am able to login but when I call the api using my access token i get a 401 unauthorized and the message says Bearer error=“invalid_token”.
Below are images showing my setup.


Hi I hope you can see the images

Hey @sellochrismodise !

Good to know you’re able to log in and get token(s) - Thanks for sharing those images :slight_smile:

  • What does your token look like when you decode it at Do you mind sharing the decoded token (sensitive info redacted) here?

  • Do you have the audience http://localhost:5000 registered as an API in Auth0?

Hi tyf yes that is the identifire of my api ap on auth0.

here is one of my access tokens:

Here is what the debugger says

Hi tyf

I had a look around and it seems like the audience was not been set correctly based on my config file. but now i get a correct access token that can get access to my api endpoints.
Heres what i did for anyone who might struggle with the same issue.


1 Like

Hey @sellochrismodise glad you were able to get this sorted!

That’ll do it! Without an audience param you were getting back an opaque token which can only be used against the /userinfo endpoint.

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