How to get if a user is admin of a page (isAdmin) using the Facebook Graph API?

后端 未结 5 1804
攒了一身酷
攒了一身酷 2021-01-06 10:37

Using the old REST API, you could do call https://api.facebook.com/method/pages.isAdmin to know if a user was the admin of a given page.

How can you do

相关标签:
5条回答
  • 2021-01-06 10:47
    $session_key = $_REQUEST['fb_sig_session_key'];//maybe there is a better way to get this
    $access_token = $facebook->getAccessToken();
    $is_admin = $facebook->api(array('method'=>'pages.isadmin', 'page_id'=>'YOUR_PAGE_ID', 'session_key'=>$session_key, 'access_token'=>$access_token));
    
    0 讨论(0)
  • 2021-01-06 10:53

    From FB docs: GET /v2.2/{page-id}/roles/{user-id}

    Also see How can i get the admins user id of a page in facebook.?.

    0 讨论(0)
  • 2021-01-06 10:54

    You may be able to view that info in the accounts connection

    0 讨论(0)
  • 2021-01-06 10:56

    You can try this:

    $page=$facebook->api('/[PAGE ID]?fields=access_token');
    if (!$page['access_token'])
        echo "is not admin";
    
    0 讨论(0)
  • 2021-01-06 11:04

    Another option would be to run FQL on page_admin table.

    0 讨论(0)
提交回复
热议问题