FB.ui方法'permissions.request'已弃用?对我来说反应永远都是假的

时间:2013-04-18 21:59:26

标签: fb.ui

这是我的代码:

    FB.ui({method: "permissions.request", "perms": 'publish_stream', 'display': 'popup'}, function (response) {
      console.log(response)
      console.log(response.perms)
    }, {scope: 'publish_stream'});

结果总是'假',有人知道原因吗?

由于

1 个答案:

答案 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' });