When I make a request to my .Net Core 2 API from my Angular app the JWT is not the same as the one sent in the request header.
Startup.cs
Faced with same issue with sub
changing to http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier
, found answer in https://stackoverflow.com/a/62881110/11593686.
But also, managed to solve the issue myself:
I've checked that resulting token contains sub
, so it gets transformed when reading/validating, so I just:
var tokenHandler = new JwtSecurityTokenHandler();
//otherwise `sub` (and some other claims) get changed to ClaimTypes.NameIdentifier
tokenHandler.InboundClaimTypeMap = tokenHandler.OutboundClaimTypeMap;
i.e. copied Outbound map to Inbound map, so they are equal.