所以我使用“Facebook-sdk”插件。我正在这样初始化 Facebook:
FB.init({ appId: 'xxxxxxxxxxx', cookie: true, xfbml: true, oauth: true, status: true });
FB.login(function(){ // get permissions
}, {scope: 'user_friends, read_friendlists, user_photos, email, publish_actions '});
FB.getLoginStatus(function (response) { // to generate AccessToken
if (response.authResponse) {
console.log('LoginStatusResponse: ' + JSON.stringify(response, null, 4));
} else {
console.log('AuthResponse: No');
}
});
然后,为了响应按钮单击事件,我正在执行以下操作:
'click #get_fb_friends' : function(event, template) {
FB.api(
"/me/friends",
function (response) {
if (response && !response.error) {
console.log('GOT them !!!' + JSON.stringify(response, null, 4));
return response;
} else {
console.log('No can do' + JSON.stringify(response, null, 4));
}
});
}
问题是我得到了一个空的数据变量:
GOT them !!!{
"data": []
}
PS:查询"/me"
会返回有关我自己的所有信息,"/me/friends"
不起作用。
可能是权限问题吗?
最佳答案
Facebook 几周前更改了其 api,只有当您的好友亲自同意使用您的应用程序时,您才能访问他们的列表。对此无能为力
关于meteor - Facebook 好友列表为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23723978/