FBJS好友生日oauth 2.0
我的 FB.login( 函数以范围结束,因为它应该:
}, {scope:'user_birthday,friends_birthday'});
在用户登录函数 requestsTest() 触发后:
function permissionsTest(){
FB.api('me/friends?fields=birthday', {fields:'birthday'}, function(response) {
alert(response.data[1]);
});
}
但是所有警报返回的是:[object Object] 当我试图看到类似的东西时:12/09/1983
这应该如何工作?
参见: graph.facebook.com/me/friends?fields=birthday
您可以清楚地看到有一个名为“data”的对象,其中包含一个名为“id”的对象数组, “生日”
我的之前的尝试:
response.data[1] 返回 [object Object]
响应返回 [object Object]
response.data[1].id 返回未定义
response.data[1].birthday 返回未定义
response.id 返回未定义
response.birthday 返回未定义
我似乎无法正确理解,我觉得我已经用尽了文档、堆栈和谷歌。
my FB.login(function ends with scope as it should:
}, {scope:'user_birthday,friends_birthday'});
after the user logs in the function permissionsTest() fires:
function permissionsTest(){
FB.api('me/friends?fields=birthday', {fields:'birthday'}, function(response) {
alert(response.data[1]);
});
}
But all the alert returns is: [object Object] when I am trying to see something like: 12/09/1983
How should this work?
see: graph.facebook.com/me/friends?fields=birthday
You can clearly see that there is an object called "data" holding an array of objects called "id" and "birthday"
My previous attempts:
response.data[1] returns [object Object]
response returns [object Object]
response.data[1].id returns undefined
response.data[1].birthday returns undefined
response.id returns undefined
response.birthday returns undefined
I can't seem to get it right and I feel I have exhausted the docs, stack and google.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有些朋友的生日可能为空。使用 Facebook Graph API Explorer 查看响应:
这是为我返回数据:
Some of the friends birthdays may be null. Check out the response with the Facebook Graph API Explorer:
This was returning data for me: