Reputation: 1601
Im developing a Facebook app with java and spring social. Is it possible to find out if a logged in user is admin of the current app? I have been looking through the api but cannot find anything. Or is there any other good way to do this with java.
Update: I did not find an specific api call in spring social to do this but it is possible to do the following which returns a json string with all the roles for the app.
facebook.restOperations().getForObject("https://graph.facebook.com/APP_ID/roles?access_token=your app token", String.class);
Upvotes: 1
Views: 1168
Reputation: 31870
Call the Graph API with an HTTP GET to /me/accounts
with that user's access token with manage_pages
permission. If you see the app listed there, then they're an admin or a developer.
Or you can use an FQL call. See: http://developers.facebook.com/docs/reference/fql/page_admin/
SELECT page_id, type from page_admin WHERE uid=me()
and see if the user is on that list.
EDIT
I just found a third way to check if a specific user is an admin of the Page, issue an HTTP GET request with the appropriate PAGE_ID, Page Access Token, and USER_ID to https://graph.facebook.com/PAGE_ID/admins/USER_ID
Upvotes: 1