I am trying to use JWT for authentication mechanism in ASP.NET Core Web API project. Suppose this project has not MVC part and does no
JWT
ASP.NET Core Web API
MVC
in your claims (second code snippet) I can only see this:
new Claim(ClaimTypes.NameIdentifier, applicationUser.UserName),
but you need to add this:
new Claim(ClaimTypes.Name, applicationUser.UserName),
then User.Identity.Name should contain the username.