I try to call the Facebook graph API to get public page pictures.
I have the "Advanced_access" for pages_read_engagement and pages_show_list in my Control App.
But when I call the page : https://graph.facebook.com/my_page/photos?access_token={token_app}
I have this error :
(#10) This endpoint requires the 'manage_pages' or 'pages_read_engagement' permission or the 'Page Public Content Access' feature.
Thinking that my token wasn't up to date, I tried to call : https://graph.facebook.com/my_page/photos?access_token={app_id}|{app_secret}
Same result. Do you have any idea ?
Related
When linking with the Instagram Basic Display, our app asks for the user_profile and user_media scopes. When linking, the user can de-select the user_media scope, which defeats the purpose of linking with our app.
I'd like to validate that the user has granted the user_media permissions, but can't figure out a good way to do it.
The Facebook Access Token Debugger is able to display the scopes that were granted when I paste in an IG Basic token.
I've tried using the /debug_token endpoint from the Graph API. It lets me debug Facebook and IG Graph tokens, but not IG Basic:
GET /debug_token?input_token=<token-to-debug>&access_token=<app-access-token>
The "app-access-token" I'm supplying is my Instagram Basic Display app's ID and secret combined together like this: app-id|app-secret
When I do this I get an error saying:
Error validating application. Cannot get application info due to a system error.
The only thing I can think of doing is to try accessing the user's IG media and detecting if it fails w/a permissions error. I'd like to avoid doing this if there is a better way :)
I ended up verifying this with an api request that tries to fetch the last media posted by the user:
(Ruby)
def validate_permissions
params = { access_token: token, fields: ['id'], limit: 1 }
get('https://graph.instagram.com/me/media', params)
end
The get method in this class has an error handler for when the HTTP status >= 400. In the error handler, if the HTTP status is a 403 and the error has a "code" of 190 then we can conclude the user has not granted the permission.
The error message in this scenario is:
Application does not have permission for this action (access user media)
I have a Facebook page of my own. What I would like is to access the posts in that page as a JSON by sending an API call. I do not need to return the content as a embedded web page like we get in the oEmbed. What is the approach to that?
In the Facebook developer dashboard I have created an application, which means, I have Client Token and App ID incase I need to have access_token to pass.
I know the Page ID of the Facebook page that I need to access
Is that a must Facebook Login integrated to retrieve such public page content?
When I run following command (True values of page_id, app_id & client_access removed here)
curl -i -X GET "https://graph.facebook.com/page_id?access_token=app_id|client_access"
I'm getting following error
{
"error":{
"message":"(#100) Object does not exist, cannot be loaded due to missing permission or reviewable feature, or does not support this operation. This endpoint requires the 'pages_read_engagement' permission or the 'Page Public Content Access' feature or the 'Page Public Metadata Access' feature.. Refer to https:\/\/developers.facebook.com\/docs\/apps\/review\/login-permissions#manage-pages, https:\/\/developers.facebook.com\/docs\/apps\/review\/feature#reference-PAGES_ACCESS and https:\/\/developers.facebook.com\/docs\/apps\/review\/feature#page-public-metadata-accessfor details. ",
"type":"OAuthException",
"code":100,
"fbtrace_id":"Aal5TRTWtw_phIz7-rHzj1L"
}
}
https://developers.facebook.com/docs/graph-api/reference/v9.0/page/feed
This documentation explains how to access the posts.
You will need to navigate to this URL ( https://developers.facebook.com/tools/explorer/
) and add the required permissions for page access. Then choose the Page Token on the right side where it says "User or Page"
You will need page token to access anything page related
According to the Facebook documentation when I call https://graph.facebook.com/v2.11/me/page_backed_instagram_accounts using the page token I get an error like this:
(#100) Tried accessing nonexisting field (page_backed_instagram_accounts) on node type (Page)
I've already checked app permission: manage_pages, publish_pages, ads_management and so on..
Anyone could help me?
Sounds like you are using a user token, not the page access level token.
I use something like this to get the FacebookId of the page backed Instagram account.
/me?fields=instagram_business_account,connected_instagram_account,instagram_accounts{id,username}
I would suggest to use the token debugger to see the details of the access token.
I'm trying to post to a facebook page (as the page and as the admin user with each one access token) with just a parameter 'message'.
I've the same error in php and in Graph API Explorer in both cases:
{
"error": {
"message": "(#1) An unknown error occurred",
"type": "OAuthException",
"code": 1,
"error_data": {
"kError": 1455002
}
}
}
The same post to the API adding a paremeter link or just link without message works fine.
The user has granted those permissions: create_note, email, manage_pages, photo_upload, publish_actions, publish_stream, share_item, status_update, user_friends, video_upload.
The app is in Sandbox Mode and the user is a test user, not a real one.
I'm able to write to user feed and to create custom actions for him.
I've verified both, the page access token and the user access token with Access Token Debugger.
I've already reviewed a lot of questions in stackoverflow, tutorials and blog posts.
What am I missing?
UPDATED: I can't either post a link in page with app access token.
I'm trying to create an album and post photo to it , these operations have to be done on a "facebook page". Before writing any code i tested it on graph api explorer :
i tries following to create an album
/page_id/albums method:post
fields :
name : "test"
access_token : "valid access_token"
i got the above mentioned access token after granting permissions like :manage_pages , photo_upload . Any ideas where i might be going wrong.
I have gone through the documents and stackoverflow questions but can't seem to figure out the problem.
i resolved the error , we have to set the access token to access token of the page . the access token can be obtained by issuing :
/me/accounts using get method.
also important thing is this will only show the list of pages to which the current user is admin to.
the access token received from the graph explorer is valid for only 1 hour, but if you receive the access token by issuing $facebook->api('/me/accounts') in php then that access token never expires.
to check if the access token is valid and related info the following link can be used to check: