With Facebook API, within a custom app added to a fanpage (tab app), how do I get the fanpage ID?
Here's what I'm trying to achieve:
- user goes to the full-width canvas app, he authorizes himself there and allows the app to add a tab to one of the fanpages he's administrating
- every Facebook user going to that fanpage, sees the tab and the tab shows content specific to that fanpage (that's why I need to know the fanpage ID)
- if fanpage administrator wants to change something, he goes to the full-width canvas and logs in to my service (here's where I store what he wants t开发者_高级运维o show in his Fanpage)
From a parsed signed request (to an tab iFrame) you can get the page id - the contents would be similar to the following (output of PHP print_r):
stdClass Object
(
[algorithm] => HMAC-SHA256
[issued_at] => xxxxxxxxxx
[page] => stdClass Object
(
[id] => FAN_PAGE_ID // target page id
[liked] => 1 // is the user a fan
[admin] => // is the user an admin
)
[user] => stdClass Object
(
[country] => ie
[locale] => en_GB
[age] => stdClass Object
(
[min] => 21
)
)
)
For more information see: http://developers.facebook.com/docs/authentication/signed_request/
精彩评论