1

What I have: ASP.NET WebAPI application with Identity framework.

What I want: use twitter and facebook for registration and auth.

What is the problem: Identity framework doesn't request for email and other personal information. It returns only username.

Thanks.

2 Answers2

1

In the Startup.Auth.cs file before this code block,

app.UseFacebookAuthentication(facebookAuthenticationOptions);

you should add

facebookAuthenticationOptions.Scope.Add("email");
Arda Güçlü
  • 728
  • 2
  • 6
  • 27
  • Then to get the email, check the email claim from the claims cookie after authentication. – danludwig Jan 16 '15 at 11:49
  • 1
    Take note however that even adding that scope, if the targeted user doesn't share his/her email (FB settings) then the framework won't be able to get it – von v. Jan 16 '15 at 11:50
1

Identity uses OAuth.

Twitter:

The API won't return an email address to you. If you're interested in a user's email address, you'll have to ask the user for it within your own application as a completely distinct act.

Google+:

How to get user email from google plus oauth

Facebook:

Get ExtraData from MVC5 framework OAuth/OWin identity provider with external auth provider

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272