One of our project requires an admin interface to upload photos into a fans page’s album.
It works like this:
-We created a dummy Facebook app – Let’s call this ‘Admin app’.
-We used a personal facebook account, this account is the Admin of the fan’s page.
While logged into the personal facebook account, we manually grant the ‘Admin app’ access to this personal facebook account’s pages. especially the ‘manage pages’ permission. This should allow the ‘Admin app’ to upload photos to the fans page on behalf of the personal facebook account.
This manual process is something like this:
1. run this in browser
2. we will get sth like this: http://YOUR_URL?code=A_CODE_GENERATED_BY_SERVER
Last time, we went through the process above and got the access_token. This token is successfully used in php codes directly to post images into a fan’s page’s photo album. Then the personal facebook account mentioned above changed his personal password. Then we got an error saying ‘Invalid Token’. This is expected. We went through the process above again to manually get a new access_token. But, whenever this new access_token is used, we got a new error saying “#120 – Invalid Album Id”.
After some struggling, we finally see some hints from a stackoverflow answer - There is a page specific access token! The steps above generated an “app access token”, I thought since the personal Facebook user has granted the “Admin App” the permissions to mange all his pages, by using that token we should be able to upload an image to ANY albums in ANY of his fans page.
But that is wrong and the truth is – We need to look at the personal facebook account’s all fans pages via https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN_GENERATED_ABOVE, Then you will see that for Each fans’ page, that is a UNIQUE ACCESS TOKEN. I quickly tried to use this unique access token for the fans page that we are working on, and viola! The ‘Invalid album id’ error is gone.
In summary, if you want a facebook app to act on behalf of a facebook fans’ page admin to manage a specific fans page, e.g. upload photo into a photo album, make sure the unique token for that fans’ page is used!
Hope this helps someone!
