I'm trying to create an album on my Facebook app using the Graph API. It's quite easy to create an album for a user account. We just need to have a user access token and send a post request for
https://graph.facebook.com/USER_ID/albums
{
name :'my USER album'
}
It seems to be logical sending the same post request for app:
https://graph.facebook.com/APP_ID/albums
{
name :'my APP album'
}
However it doesn't work. I use the app token which I get from: access token tool.
Does anybody know how can I do this?
I found a solution. It's quite wird, but what can I do.
Only a user who is an admin of the app can create new albums and photos. If you meet this criterion your app needs to request the user for one more permission: manage_pages
.
After this you can request http://graph.facebook.com/ADMIN_USER_ID/accounts
. There you will get an array of all pages managed by this user. Find en element which contains your APP_ID
. The same element contains an access_token
which is required to perform create album and upload photo actions.
Quite simple solution detailed on the facebook Authentication documentation.(Scroll down to "App Login")
You have to query this url :
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
the response will be an access token that you can use to perform actions on behalf of you app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With