trying to determine if user is a page admin using FB GraphAPI

I have a page tab app. When the user clicks on the "Go to App" and is sent to my page tab edit url i am trying to determine if they are a page admin or not. I have tried two different methods. I have tried from the only admin/owner of the page method 1 used from https://developers.facebook.com/blog/post/2011/09/05/platform-updates--labor-day-edition/

 $page_info = $facebook->api("/".$pageID."?fields=access_token");
 $pageAccessToken = $page_info['access_token']     

 $is_admin_url = "https://graph.facebook.com/" . $pageID 
  . "/admins/" . $FBuser . "?access_token=" 
  . $pageAccessToken;

$response = file_get_contents($is_admin_url);

response is {"data":[]}

I have also tried::

path = '/'.$pageID.'/admins/'.$FBuser;
$params = array(
        'app_id' => FB_APP_ID,
        'access_token' => $pageAccessToken
);
$is_admin = $facebook->api($path, 'POST', $params);

Answers


Although PAGE_ID/admins is a valid request, you need an admin's access_token to see the list. I.e. only admins can see who else is an admin.

What you can do is approach this from the other end by yielding a list of pages that the user is an admin of (using the https://graph.facebook.com/USER_ID/accounts/ data and the manage_pages permission) and search through that list for your application.

However, I would understand if some users would be reluctant to give the manage_pages permission, as it also provides an access token to authenticate as that page, which would be something of a security hole on their part. Unfortunately, there does not seem to be another way to access a list of pages for which that user is an admin.


Need Your Help

Python NumPy Convert FFT To File

python audio filter numpy fft

I was wondering if it's possible to get the frequencies present in a file with NumPy, and then alter those frequencies and create a new WAV file from them? I would like to do some filtering on a fi...

UAC on Win2k8/VIsta x64 - local “Administrator” works but domain account in Administrators group fails?

dns 64bit uac local administrator

I have come across a strange problem in one of our applications on win2k8/Vista x64 with UAC enabled. It is a process which hosts the UI for our service and runs in the context of the logged on use...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.