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

Jia*_*Jia 2 fb.ui

这是我的代码:

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

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

谢谢

Eri*_*don 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' });
Run Code Online (Sandbox Code Playgroud)