Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added link to blog post
Source Link
Tore Nestenius
  • 20.4k
  • 5
  • 36
  • 48

Then Microsoft and IdentityServer have different opinion on what the name of the claims should be, so you need to point out, which claim is the name claim, by using:

 .AddJwtBearer(opt => { opt.TokenValidationParameters.RoleClaimType = "roles"; opt.TokenValidationParameters.NameClaimType = "name"; ... 

To debug claim issues, it can be very good to actuallyactually look at what does the access token actually contain? Use a tool like https://jwt.io/ to do that.

To complement this answer, I wrote a blog post that goes into more detail about this topic: Debugging JwtBearer Claim Problems in ASP.NET Core

Then Microsoft and IdentityServer have different opinion on what the name of the claims should be, so you need to point out, which claim is the name claim, by using:

 .AddJwtBearer(opt => { opt.TokenValidationParameters.RoleClaimType = "roles"; opt.TokenValidationParameters.NameClaimType = "name"; ... 

To debug claim issues, it can be very good to actually look at what does the access token actually contain? Use a tool like https://jwt.io/ to do that.

Then Microsoft and IdentityServer have different opinion on what the name of the claims should be, so you need to point out, which claim is the name claim, by using:

 .AddJwtBearer(opt => { opt.TokenValidationParameters.RoleClaimType = "roles"; opt.TokenValidationParameters.NameClaimType = "name"; ... 

To debug claim issues, it can be very good to actually look at what does the access token actually contain? Use a tool like https://jwt.io/ to do that.

To complement this answer, I wrote a blog post that goes into more detail about this topic: Debugging JwtBearer Claim Problems in ASP.NET Core

Source Link
Tore Nestenius
  • 20.4k
  • 5
  • 36
  • 48

Then Microsoft and IdentityServer have different opinion on what the name of the claims should be, so you need to point out, which claim is the name claim, by using:

 .AddJwtBearer(opt => { opt.TokenValidationParameters.RoleClaimType = "roles"; opt.TokenValidationParameters.NameClaimType = "name"; ... 

To debug claim issues, it can be very good to actually look at what does the access token actually contain? Use a tool like https://jwt.io/ to do that.