Facebook 只返回用户的姓名和 ID [英] Facebook only returning name and id of user
问题描述
我正在尝试使用我的 Facebook 帐户登录我的网站,但 Facebook 仅提供名称和 ID 不足以登录用户.在我获得名字、姓氏、电子邮件等完整信息之前.
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
声明性字段
为了尝试提高移动网络的性能,v2.4 中的节点和边缘要求您明确请求您的 GET 请求所需的字段.例如,GET/v2.4/me/feed
不再默认包含赞和评论,而是 GET/v2.4/me/feed?fields=comments,likes
将返回数据.有关更多详细信息,请参阅有关如何请求特定字段的文档.
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
这篇关于Facebook 只返回用户的姓名和 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!