How do I get current user in .NET Core Web API (from JWT Token)
The accepted answer did not work for me. I’m not sure if that’s caused by me using .NET Core 2.0 or by something else, but it looks like the framework maps the Subject Claim to a NameIdentifier claim. So, the following worked for me: string userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; Note that this assumes the Subject sub … Read more