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, Facebook, or Microsoft. However, I would still like to get peoples' e-mail address (e.g. for notifications, updates, etc.).
By default the app.UseGoogleAuthentication()
will also request the user's e-mail address. For Facebook, I've created a new instance of the FacebookAuthenticationOptions
class, and added the following scope: facebook.Scope.Add("email")
. This also works.
I'm having problems getting the e-mail for people using a Microsoft Account. The MicrosoftAccountAuthenticationOptions
also has a Scope
property, but adding email
doesn't seem to work. In the documentation I see there is a scope wl.emails
but it returns an array of e-mail addresses and I'm not sure if this is the equivalent for email
with Facebook.
Does anyone have a suggestion how to get the e-mail address as a claim when authenticating?
Configure the scopes for Microsoft.
Grab the email claim
Hope this helps you.
and to get email