put email behind if wall

This commit is contained in:
Tommy Parnell
2016-11-21 17:25:59 -05:00
parent e0b97f3bb5
commit 4112051063

View File

@@ -95,10 +95,12 @@ namespace Owin.Security.Providers.VKontakte
var user = await GetUser(response, accessToken);
var context = CreateAuthenticatedContext(user, accessToken, properties);
// Email support. VK send it with access_token
context.Identity.AddClaim(new Claim(ClaimTypes.Email, response["email"].ToString(), XmlSchemaString,
Options.AuthenticationType));
var email = response["email"]?.ToString();
if(!string.IsNullOrWhiteSpace(email))
{
// Email support. VK send it with access_token
context.Identity.AddClaim(new Claim(ClaimTypes.Email, email, XmlSchemaString, Options.AuthenticationType));
}
await Options.Provider.Authenticated(context);