79093673

Date: 2024-10-16 10:46:21
Score: 0.5
Natty:
Report link

Assuming it's named id in the claims:

var identity = principal.Identity as ClaimsIdentity;
if (identity != null && identity.IsAuthenticated)
{
    var idClaim = identity.FindFirst("id");
    if (idClaim != null)
    {
        string id = idClaim.Value;
        ...
    }
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: hakim00