4

I have created new facebook app for my application. Now this app is with api version 2.4. I was using below code for login with owin.

        app.UseFacebookAuthentication(new FacebookAuthenticationOptions()
        {
            AppId = "xx",
            AppSecret = "xxx",
            Scope = { "email", "public_profile" }                          
        });

This code was working fine and returning me the email address with older facebook app with api version 2.3. But now with the api version2.4, it is not returning email. It is asking user for permission to share email bur not returning email in login info.

Is there any modification with api 2.4 which I am missing ?? Please suggest. Thanks in advance . .

Shahbaz Khan
  • 133
  • 1
  • 10

1 Answers1

2

I would imagine that the Owin Facebook authentication needs an update. The current version was updated in Feb 2015, prior to v2.4 of the Graph API.

With v2.3 and below calling https://graph.facebook.com/v2.3/me would have returned email, name, id, gender etc. In v2.4 this will just return name and in v2.4 this will just return name and id.

https://graph.facebook.com/v2.4/me

{ "name": "Name Returned", "id": "1343143144321" }

Therefore If you require the email address you will need to implement your own fix in your code.

In your server side implementation request the email address to be specifically returned https://graph.facebook.com/v2.4/me?fields=email&access_token=

Hey Darren
  • 306
  • 1
  • 6
  • 1
    I did it by adding access token claim to owin request and then sent one more request for email via graph api. – Shahbaz Khan Sep 02 '15 at 12:08
  • For a clean solution on how to solve this problem, please see this answer http://stackoverflow.com/a/32636149/790635 – emp Apr 18 '16 at 19:27