Ian Warner
Ian Warner

Reputation: 1068

Facebook Page Permission Query

The problem is

  1. On a Facebook Page Tab we want to show details of all the other global pages
  2. This includes Name and Total Likes for the page

I have a user set up currently which has admin rights over all the pages, the access token is that of the user with offline permissions set for each page too; hard coded into an FQL query

The issue with this is if the user changes password - then this access token is invalidated.

I know it is possible to get a new one assigned - but with the new requirement to also set Manage_Page to access page information is there a better solution

ie one user with manage permissions over mutiple pages able to do one FQL call to get the required information for multiple pages.

Cheers

Ian

Upvotes: 1

Views: 712

Answers (1)

jBit
jBit

Reputation: 2981

If you are getting data on Facebook Fan Pages, then getting information like name and total likes can be done without a token as that information is public.

For example:

Multiple Pages Request as a Facebook JavaScript SDK Example:

FB.api(
    '/', 
    {ids : "19292868552,11239244970"}, 
    function(response) { 
        if (!response || response.error) {
            console.log(response.error); 
        } else { 
            console.log(response); 
        } 
    }
);

Initialising the JavaScript SDK with user session data - for accessing restricted page data:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({
    appId  : <your-app-id>,
    session : { "uid":"<users facebook id>", "access_token":"<valid access token>"},
    cookie : true, 
    xfbml  : true
  });
</script>

Upvotes: 5

Related Questions