В .NET 7 я делал следующее:
Код: Выделить всё
return auth?.User?.Claims?.SingleOrDefault(x => x.Type == "email")?.Value;
Код: Выделить всё
return auth?.User?.Claims?.SingleOrDefault(x => x.Type == @"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress")?.Value;
Подробнее здесь: https://stackoverflow.com/questions/789 ... ot-working