Facebook: get list of pages that a user is admin of
I solved it with some FQL:
FB.api({method: 'fql.multiquery',
access_token: <access_token>,
queries: {
query1: 'select page_id from page_admin where uid = ' + <uid>,
query2: 'select page_id, name, page_url from page where page_id in (select page_id from #query1)'
}
}, function(queries){
var pages = queries[1].fql_result_set;
}}
Its simple with Graph API. Steps:
- Get the
manage_pages
permission from the user (extended permissions). - Call the Graph API - https://graph.facebook.com/me/accounts
You can test this procedure in the graph explorer -> Just click on 'Get Access Token' button-> under 'Extended permission' check 'manage_pages' & submit it. It will give you the admin-page-details JSON.