这是我的代码:
FB.ui({method: "permissions.request", "perms": 'publish_stream', 'display': 'popup'}, function (response) {
console.log(response)
console.log(response.perms)
}, {scope: 'publish_stream'});
结果总是'假',有人知道原因吗?
由于
答案 0 :(得分:5)
permissions.request
的规范中FB.ui
对话框不是(不再是?):
https://developers.facebook.com/docs/reference/javascript/FB.ui/
似乎确保用户登录和的唯一方法是拥有操作所需的权限,即使用FB.login()
与适当权限范围的组合,以及然后FB.api('/me/permissions')
查询图表:
FB.login(function(response) {
if (response.status === 'connected') {
FB.api('/me/permissions', function(response) {
if (response.data && response.data[0] && response.data[0].publish_actions) {
console.log("You got'em!");
}
});
}
}, { scope: 'publish_actions' });