Auth0 Home Blog Docs

After Auth0 login- 401 back

jwt
auth0

#1

I used the quickstart for .net core 2.0 client (api explorer) and web api in order to obtain a token which will give me access to use my authorized api.

I got working the login and to obtain an access_token but when I use that access_token I receive back a 401.
Where can be the error? code or auth0?

Here is a link to my project


#2

Take a look at your token validation in your WebAPI. You should be doing a validation on the access token. You need to make sure that is configured correctly. I would walk through it with a debugger. Make sure you are setting the audience and issuer correctly, and make sure you are using RS256 signature validation correctly.


#3

I went with the debugger and I have back my token which contains the audience(my api) but when I call that api I get back a json which contains my token and information about. I don’t receive back information from my api.


#4

It sounds like it might be something within your API.

You added an authorization policy with read:messages. Which endpoint are you calling? Do you have the read:messages scope in your token?

I’m curious what you mean by “I get back a json which contains my token and information about”


#5

By “I get back a json which contains my token and information about” i mean that I was getting back a json with my token inside and my error number in this case 401.

My error was actually from my API. A letter spelled incorrect and a lot of bad things can happen.

Thanks for your help anyway.