Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IdentityServer4 - 'sub' claim is missing

I've created a sample MVC application which uses identity server to do the authentication against Google. Authentication works ok but when the response comes back it is missing 'sub' claim and end up with the error that says 'sub claim is missing'.

I read few article which talks about claimmapping to map nameidentifier to sub. but have no idea on how to do that. There are someblog which says to inform google to issue the sub claim. but again not sure how to do that.

Looking forward for some help!

like image 322
Himal Patel Avatar asked Oct 16 '25 14:10

Himal Patel


1 Answers

Maybe similar to what I was seeing yesterday. I found a workaround here

Basically some standard claims get mapped to MS proprietary keys by default. You can prevent that by doing : JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

Hope that helps!

like image 71
TheMethod Avatar answered Oct 19 '25 10:10

TheMethod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!