Category Archives: ASP.NET Identity

Google authentication get email from ASP.NET Identity

So how do you obtain the external user email (the one authentication by google), first name and name in an ASP.NET website using ASP.NET Identity?

var email = externalIdentity.FindFirstValue(ClaimTypes.Email);

and here is getting the type

public static string FindFirstValue(this ClaimsIdentity identity, string claimType) 
    {
        Claim claim = identity.FindFirst(claimType);
        if (claim != null) 
        {
            return claim.Value;
        }
        return null;
    }

For more information take a look at Decoupling OWIN external authentication from ASP.NET Identity