Quantcast
Channel: Bryan Avery - Blog
Viewing all articles
Browse latest Browse all 10

Google authentication get email from ASP.NET Identity

$
0
0

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


Viewing all articles
Browse latest Browse all 10

Trending Articles