Sarika
Sarika

Reputation: 1

Facebook graph api for getting user facebook fan page list

I have a problem while getting the list of facebook fan pages using the graph api.

I am using:

https://graph.facebook.com/{userfacebookid}/accounts?access_token={access_token}&scope=manage_pages

But I am getting empty result like this:

{
   "data": [

   ]
}

Upvotes: 0

Views: 4951

Answers (2)

Nuthan Murarysetty
Nuthan Murarysetty

Reputation: 1

I am also faced same problem while getting our pages(i.e., created by us) and i tried but at last i got the solution

While authentication time u have to pass permissions like below

https://graph.facebook.com/oauth/authorize?client_id=YOUR_APP_ID&redirect_url=YOUR_REDIRECT_URI&scope=manage_pages,user_subscriptions

Upvotes: 0

ifaour
ifaour

Reputation: 38135

ONE: You should start by reading the authentication flow. Here's the Server-Side Authentication document

https://www.facebook.com/dialog/oauth?
    client_id=YOUR_APP_ID
   &redirect_url=YOUR_REDIRECT_URI
   &scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES
   &state=SOME_ARBITRARY_BUT_UNIQUE_STRING

Here you should ask for the manage_pages permission

TWO: Once you have the user access token with this permission you can retrieve the pages the user administer:

https://graph.facebook.com/{userfacebookid}/accounts?access_token={access_token}

THREE: This won't retrieve the pages the user is fan of!

Upvotes: 4

Related Questions