I\'m using the ASP.NET Identity stuff that came with the new MVC 5 templates in VS2013. I\'ve configured external login providers so people can sign up using Google, Faceboo
Configure the scopes for Microsoft.
var mo = new MicrosoftAccountAuthenticationOptions
{
Caption = "Live",
ClientId = clientId,
ClientSecret = clientSecret,
};
mo.Scope.Add("wl.basic");
mo.Scope.Add("wl.emails");
app.UseMicrosoftAccountAuthentication(mo);
Grab the email claim
var identity = await AuthenticationManager.AuthenticateAsync(DefaultAuthenticationTypes.ExternalCookie);
var emailClaim = identity.Identity.FindFirst(ClaimTypes.Email);
Hope this helps you.
app.UseMicrosoftAccountAuthentication(new MicrosoftAccountAuthenticationOptions()
{
ClientId = "Your_client_id",
ClientSecret = "your_client_secret_key",
Scope = { "wl.basic", "wl.emails" }
});
and to get email
var externalIdentity = HttpContext.GetOwinContext().Authentication.GetExternalLoginInfoAsync();
string email=externalIdentity.Result.Email;