Facebook应用程序API检查用户是否是facebook中的应用程序管理员

pal*_*mic 5 facebook-graph-api

我有:

如果用户是facebook中的应用程序管理员,我可以以某种方式得到这个吗?

orb*_*rba 6

要获得此类信息,您可以使用FQL:

protected function authorizeByFb(){

        $result = $this->fb->api(array(
          'method' => 'fql.query',
          'query'  => "SELECT developer_id FROM developer WHERE application_id='{$appId}' AND developer_id='{$fbUserId}'",
        ));     

        if(count($result)==1){
            return true;
        }

        return false;
    }
Run Code Online (Sandbox Code Playgroud)


M A*_*onu 2

如果您开发的应用程序正在检查登录 Facebook 用户的角色,或者您的应用程序只是想识别其所有者或管理员,那么 http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts应该列出该应用程序 ID

接口调用:

FB.api('/me/accounts', 'get', {"access_token":access_token}, function(response){
    //loop through response to check any application id matches current application id
});
Run Code Online (Sandbox Code Playgroud)

响应样本:

{
  "name": "app_name",
  "access_token": "current_token_here",
  "category": "Application",
  "id": "your_owned_app_id"
},
{
  "name": "app_name1",
  "access_token": "current_token_here",
  "category": "Application",
  "id": "your_owned_app1_id"
},
Run Code Online (Sandbox Code Playgroud)