Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

facebook application API check if user is application admin in facebook

i have:

  • user facebook data ( https://graph.facebook.com/btaylor )
  • facebook application data ( https://graph.facebook.com/2439131959 )

Is somehow possible to get if user is application administrator in facebook with this in my hands?

like image 222
palmic Avatar asked Nov 11 '10 10:11

palmic


People also ask

What data is available from Facebook API?

Facebook API is a bundle of solutions used as a primary way to get data in and out of the platform. It enables developers and app users to access the functionality of this network: user information, photos and videos, messages and more.

How do I find Facebook user data?

You can get user data by using the Facebook Graph API if the user has given their permission to share their data and your app has the appropriate permissions to receive this data. This topic shows you how to make a single request for data and how to have a batch of requests in a single request.

How do I find my Facebook API User ID?

The simplest way to get a copy of the User Profile object is to access the /me endpoint: FB. api('/me', function(response) { }); This will this will return the users name and an ID by default.


2 Answers

To get this kind of information you can use 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;
    }
like image 96
orba Avatar answered Jan 01 '23 00:01

orba


if your developed application is checking the role of the logged in facebook user or simply your application wants to recognize it's owner or admin, then http://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts should have that application id listed

api call:

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

response sample:

{
  "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"
},
like image 28
M A Hossain Tonu Avatar answered Jan 01 '23 00:01

M A Hossain Tonu