user.identity is null .net core code example Example: asp.net core user.identity.name is null new Claim(JwtRegisteredClaimNames.UniqueName, user.UserName)