Facebook只返回用户的姓名和身份 [英] Facebook only returning name and id of user
问题描述
我正在尝试使用我的Facebook帐户登录我的网站,但Facebook只提供不足以登录用户的名称和身份。在我获得完整的信息,如名字,姓氏,电子邮件等之前。
I am trying to login to my website using my Facebook account but Facebook is giving name and id only that is not enough to login user. Before I was getting full information like firstname, lastname, email etc.
Facebook现在提供的数据:
Data provided by facebook now:
stdClass Object
(
[name] => FName LName
[id] => 236189327864097
)
我使用Oauth v2.0通过Facebook登录到我的网站。
I am using Oauth v2.0 to login users through Facebook to my website.
推荐答案
看起来你正在使用Graph API的v2.4。请参阅
Looks like you're using v2.4 of the Graph API. See
- https://developers.facebook.com/docs/apps/changelog#v2_4
声明性字段
为了提高移动网络的性能,v2.4中的节点和边缘要求您明确请求您需要的字段您的GET请求。例如,GET /v2.4/me/feed
默认情况下不再包含喜欢和评论,但GET /v2.4/me/feed ?fields = comments,喜欢
将返回数据。有关更多详细信息,请参阅有关如何请求特定字段的文档。
Declarative Fields
To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example,GET /v2.4/me/feed
no longer includes likes and comments by default, butGET /v2.4/me/feed?fields=comments,likes
will return the data. For more details see the docs on how to request specific fields.
要了解如何使用所谓的字段扩展,看看
To get an idea how to use the so-called field expansion, have a look at
- https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4#fields
这篇关于Facebook只返回用户的姓名和身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!