Always getting 401 when validating tokens
See original GitHub issueUsing this code:
services.AddAuthentication(options =>
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.Authority = "http://localhost:9000"; // OpenIddict running there
options.Audience = "demo-resource-server";
if (Env.IsDevelopment())
options.RequireHttpsMetadata = false;
});
I always get 401 Unauthorized
even when my token is valid. Any ideas why?
I am using asymmetric RSA keys.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
ASP.NET core JWT authentication always throwing 401 ...
First you need to check that the JWT token generated using your configureServices code is valid or not.To validate JWT token you can...
Read more >Always returning 401 Unauthorized with a JWT Token ...
All of this works fine. When I try to modify this code to verify the id_token (JWT Token signed using RS256) from OpenID...
Read more >401 Unauthorized: Consuming web api with JWT ...
If PostMan and the client application use exactly the same JWT but the client returns a 401 then there must be a problem...
Read more >ASP.NET Core Web API: Troubleshooting
If the configuration of your JSON Web Token (JWT) middleware does not match the JWT that was passed to the API, you get...
Read more >Valid access token still getting a 401
I have a client app in React which authenticates correctly with Auth0, the access token received is valid and contains the proper audience ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oops, had a bad environment check. Sorry for dragging this out and thanks for the quick replies!
Do you use ephemeral keys?