8

与 Facebook 应用程序集成时oauth.io,我们可以选择的最新 API 版本是v2.3.

登录过程虽然有效,但是,当尝试检索用户数据(/me)时,只有元素nameid正在从oauth.io响应的原始数据中传递:

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

我们得到以下回应:

{
    "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"
        }
    }
}

如果我们直接使用 Facebook 拨打电话,如果我在 URL 中指定它们,我可以获得额外的字段:

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

我们得到我们正在寻找的数据:

{
   "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"
}

原因很清楚:因为v2.4Facebook 需要fields参数来检索额外数据。在https://developers.facebook.com/blog/post/2015/07/08/graph-api-v2.4/下查看更少的默认字段以获得更快的性能

你知道有没有办法告诉 oauth.iofields在调用 facebook/me调用时填写参数?

顺便说一句,使用:

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

不起作用。

4

1 回答 1

3

Oauth.io已解决问题,可从1.0.0-beta.18

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

于 2016-02-23T10:06:47.200 回答