I'm creating a app that publish content on instagram automatically. But, I need publish content for new users in my app, for example: A new user enter with your "username" and my application will publish a content for this new user.
In this case i got ID from account from new user in below endpoint.
https://graph.facebook.com/v10.0/business_id_from_my_dev_account/fields=business_discovery.username(<new_user_name>){username,website,name,ig_id,id}
After request, i caught businnes_id_from_new_user from response['business_discovery']['id']
When a try create a publishing container using this new user "businnes_id_from_new_user", I receive the error :
URL: https://graph.facebook.com/v10.0/**businnes_id_from_new_user**/media?access_token=<access_token>&image_url=<public_image_url>&caption=texto
Error: Unsupported post request. Object with ID 'businnes_id_from_new_user' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api.
By this error I beleave thats add permission in facebook developer page must solve, but, for each new user I have to grant manually??
Observations:
- My new users maybe it doesn't have facebook pages.
- In all requests i'm using the access token from business_id_from_my_dev_account
I logged in with Facebook using the javascript SDK and obtained the access token (I am simulating an end user who will use my application). In this login I used the following permissions
FB.login(function(response){
console.log(response)
}, {scope: 'public_profile,ads_management,business_management,instagram_basic,instagram_content_publish,pages_read_engagement,manage_pages,pages_show_list'});
The login worked correctly and I accepted the permissions through the facebook page. However when I try to get the facebook page ID for this user (using his access token) I get an empty response.
GET: https://graph.facebook.com/v10.0/me/accounts?access_token=<token_from_new_user>
Response: {
"data": []
}
Can anyone tell me why I am getting an empty answer?
Note: The logged in user already has a Facebook page and permissions have already been enabled.
api.instagram.com/oauth
is for the IG Basic Display API. You need to implement Facebook login - developers.facebook.com/docs/instagram-api/getting-started – CBroe