简体   繁体   中英

Find out if a fb user is app admin in spring social/java

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);

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM