facebook图表api只返回一些网站的名称和ID [英] facebook graph api returns only name and id for some websites
问题描述
我已经开发了一个wordpress插件,用于使用Facebook进行社交登录。
我正在使用Facebook图表API / me
来检索用户的详细信息,当我安装了一个Facebook登录插件时,我的问题是一些网站我只是获取用户ID和名称
I've developed a wordpress plugin for social login using facebook.
I'm using the facebook graph API /me
to retrieve the user details, What my problem is for some websites when installed a facebook login plugin i'm just getting user id and name only
Array
(
[name] => John doe
[id] => 398463877009801
)
但同样的代码正常工作一些网站也。
but same code is working well for some websites as well.
Array
(
[id] => 398463877009801
[email] => something@gmail.com
[first_name] => John
[gender] => male
[last_name] => Doe
[link] => https://www.facebook.com/app_scoped_user_id/398463877009801/
[locale] => en_US
[name] => John Doe
[timezone] => 5.45
[updated_time] => 2015-05-03T11:24:16+0000
[verified] => 1
)
该网站的错误可能仅仅是名字和ID?
What might be the possibilities of the errors for the site that is getting only name and id?
推荐答案
正如CBroe在上述评论中已经指出的那样,Facebook API比2.4版本更新了响应和请求的发送方式。
As CBroe already pointed out in the above comment, the Facebook API - newer than version 2.4 - changed the response and the way the requests are being sent.
您必须在请求中指定要从Graph API返回的每个字段。
例如,如果您希望字段电子邮件
和名称
返回,您必须在请求中添加它们,如下所示:
For example, if you want the fields email
and name
returned, you must add them inside the request like this:
/me?fields=email,name
这篇关于facebook图表api只返回一些网站的名称和ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!