Now there is new way to get user id from httpcontext.
There is object called User in HttpContext which have user all claim principals pulled out from JWT.
Example:
TestController.cs:
[HttpGet]
public IActionResult Test() {
var id = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
OR
var id = HttpContext.User.GetId();
return Ok(id);
}
Now there is new way to get user id from httpcontext. There is object called User in HttpContext which have user all claim principals pulled out from JWT. Example:
TestController.cs: [HttpGet] public IActionResult Test() { var id = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier); OR var id = HttpContext.User.GetId(); return Ok(id); }
close #61