previously I was using AspNet Microsoft.AspNet.Identity; to get the current user ID accessing api with following code
Microsoft.AspNet.Identity;
string userId = User.Identity.GetUserId();
Now I migrated whole project from AspNet to AspNetCore but how can I get current user ID accessing api?
Tried following code which returned username
var userName = User.FindFirstValue(ClaimTypes.Name);
I googled and found I have to use the following code to get userID,
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
but it returned with 204, No Content