Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oauth.io only gets "name" and "id" in the raw data from Facebook v2.4 and v2.5

When integrating a Facebook App with oauth.io, the latest API version we can choose is v2.3.

The login process works though, but, when trying to retrieve the user data (/me), only the elements name and id are being delivered in the raw data from the oauth.io response:

curl "https://oauth.io/auth/facebook/me" 
     -H  “oauthio:k=<myOauthKey>&access_token=<fbAccessToken>"

we get following response:

{
    "status": "success",
    "data": 
    {
        "id": "fbId",
        "avatar": "https://graph.facebook.com/v2.3/fbId/picture",
        "name": "User Name",
        "gender": 1,
        "url": "https://www.facebook.com/fbId",
        "raw": 
        {
            "name": "User Name",
            "id": "fbId"
        }
    }
}

If we make the call directly using Facebook, I can get extra fields if I specify them in the URL:

curl "https://graph.facebook.com/v2.5/me?access_token=<fbAccessToken>
      &fields=name,email,gender,birthday,first_name,last_name,picture"

we get the data we are looking for:

{
   "name": "User Name",
   "email": "email\u0040email.com",
   "gender": "female",
   "birthday": "03/02/1994",
   "first_name": "User",
   "last_name": "Name",
   "picture": {
      "data": {
         "is_silhouette": false,
         "url": "https://scontent.xx.fbcdn.net/hprofile-xlt1/v/t1.0-1/p50x50/whatever"
      }
   },
   "id": "fbId"
}

The reason is clear: since v2.4 Facebook requires the fields parameter to retrieve the extra data. See Fewer default fields for faster performance under https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/

Do you know if there is any way to tell oauth.io to fill the fields parameter when calling the facebook /me call?

Btw, using:

https://oauth.io/auth/facebook/me?fields=name,email,gender,birthday

does not work.

like image 477
Ruben Avatar asked Feb 19 '16 12:02

Ruben


People also ask

How do I use OAuth on Facebook?

Under Products in the App Dashboard's left side navigation menu, click Facebook Login, then click Settings. Verify the Valid OAuth redirect URIs in the Client OAuth Settings section. state . A string value created by your app to maintain state between the request and callback.

What client OAuth settings Facebook?

Select Settings in the left side navigation panel and under Client OAuth Settings, enter your redirect URL in the Valid OAuth Redirect URIs field for successful authorization.

What data can you get from Facebook API?

Facebook API is a bundle of solutions used as a primary way to get data in and out of the platform. It enables developers and app users to access the functionality of this network: user information, photos and videos, messages and more.

How do I pull data from Facebook?

If you want to download a copy of your information from Facebook, you can use the Download Your Information tool. Tap in the top right of Facebook. Scroll down and tap Settings. Scroll down to Your Facebook Information and tap Download Your Information.


1 Answers

Oauth.io has fixed the issue and is available from 1.0.0-beta.18

https://github.com/oauth-io/oauthd/commit/7beec64ab39955c3afd2eb28ecf7288c74ccdc96

like image 52
Ruben Avatar answered Sep 30 '22 19:09

Ruben