Facebook Graph API - Whitelisting - facebook

QUESTION EDITED TO BE MORE SPECIFIC:
When attempting to read 'views' field for a user's public videos using the Graph API:
https://graph.facebook.com/v2.5/facebook/videos?access_token=<token>&fields=views
Using my application's access token, I receive the following error message:
(#3) App must be on whitelist
However, making the same request using the facebook Graph Explorer (with a Graph Explorer access token) the data is returned correctly.
Does anyone know how to request for an application to be adding to the said whitelist?When trying to extract data from the Facebook Graph API I get the message: "(#3) App must be on whitelist"
Thanks

Just go to your facebook app's setting>advanced setting and in 'Server IP Whitelist' field. mention the IP from which you are making request to Graph API

Related

How to get PAT (Page Access token) in inst gram using Instagram id (instagram_business_account) using Facebook graph api

I want to get user PAT (Page Access token) of Instagram user using Instagram id (instagram_business_account) using Facebook graph API.
I have followed their documentation. They have written to use API:
https://graph.facebook.com/{page-id}?fields=access_token&access_token={user-access-token}
But I'm getting an error "Tried accessing nonexisting field (access_token) on node type (IGUser)"
This API is working fine for getting name and other stuff but access_token is sending an error. I have also tried Graph API Explorer but facing same issue.

Issue creating app requests on facebook http graph api

When trying to create app requests through facbeook http graph api I'm getting the error "(#2) Failed to create any app request".
As described in the documentation (https://developers.facebook.com/docs/graph-api/reference/user/apprequests/) I'm using the URL https://graph.facebook.com/{userid}/apprequests setting in post the access token, a title and a message. I've tried different combinations of parameters just to check if I needed anything else, but just if I remove access token and/or title I get different errors.
In addition to that, if I use my own userid, instead of other userid (obviously a friend) that I want to send the request to, there's no error at all, but no request is created.
I don't think it may be related with permissions because both users (source and destination of the request) are admin, developer or tester of the app.
Thank you
Just in case anyone needs it, the problem is that user apprequests can only be created if using any facebook ui methods. That's why in this thread Apprequest of Android Facebook sdk 3.0 comment 1 advices to use webdialog instead of sending the request in code.
More on this topic, I've been researching and I found out that I started with my app really long ago (using API lower than 2.3) so I didn't need to set the category as "game" to be able to send apprequests. I updated its category and after multiple tests I've found the following scenarios:
Javascript API works correctly to send requests in my app
Graph API fails to send requests if using user auth token getting the same error as before
Graph API is able to send requests if using app auth token (from app_id + app_secret)
As far as I've read, there's no limitation in using either kind of auth tokens for apprequest calls.
In addition, my app will be running in web, desktop and mobile. The scenario in which I'm using graph API directly is desktop for obvious reasons (there's other APIs tor the other platforms). As recommended in the FB api documentation, the app secret should not be included in binary code deployed to users, so I would need to use the user auth token.
Any help would be apreciated
Thanks

Facebook js api for public photo returns unsupported get request

i am trying to use facebook javascript api to get the details of a public photo uploaded by a user. The photo_id is 645046238933001, and i am using this code:
FB.api('/645046238933001', function(response){...} ). the code is executed in a browser when a user is logged in to my app using facebook.
Using graph api explorer and an app access token i am able to get the photo object but with any other valid user access token (not the user uploaded the photo) facebook returns "unsupported get request..." (using graph api explorer)
what might be the problem?
thank you
That´s intentional. Even if the photo is public, you still need a User Token of the correct user to get access with the API.
The Facebook docs are a bit misleading, the info seems to be outdated because it actually would only be possible for photos on Pages:
Any valid access token for any photo with public privacy settings.
...in the next line there´s the correct info:
For any photos uploaded by someone, and any photos in which they have
been tagged - A user access token for that person with user_photos
permission
Also, even if you would get the photo of another user: It is not possible to like a post/photo on Facebook with the API.

Suggestions on a website that uses Facebook's Graph API

I'm trying to build a website with the following requirements. I need help to see if it's possible at all. This website has a regular login (not Facebook). Upon being logged in, the user has the option to "attach" his facebook account. At this point I save the return user id in the DB. Then, I tried on another computer the following Facebook Graph API call with this user id but it said:
Fatal error: Uncaught GraphMethodException: You can only access the "home" connection for the current user. thrown in /home/public/vendor/facebook/php-sdk/src/base_facebook.php on line 1294
The call:
/{user-id}/home
Appreciate help.
According to the error message you're trying to call /{user-id}/home but are using an access token from a different user -
You can't fetch another user's news feed, only the current user of your app, using their access token
Try {user-id}/feed. If you are not using the accessToken that was generated by the facebook API on the "attach" time, you will be able to get only the public feeds/data. Using the access token that was generated at the "attach" time, you will be able to get data for your app permissions.
About access token
https://developers.facebook.com/docs/facebook-login/access-tokens
How to use the graph api
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0

How to Get feed of public Facebook page using Graph api?

There are already several questions on StackOverflow ( Can you get a public Facebook page's feed using Graph API without asking a user to allow? Get public page statuses using Facebook Graph API without Access Token? )concerning my question: I need to get through the graph API the feeds of a public page on facebook.
I followed the instructions but I always get:
{"Error": {"message": "An access token is required to request this resource.", "Type": "OAuthException", "code": 104}}
how can I fix this? I'm going crazy because everyone seems to work except me! thanks
Based on your description, the error is that you weren't supplying a valid access token with your request.
If the app's type is set to 'Native / Desktop' it's assumed you distributed the app's secret key with the binary, and thus the app access token isn't trusted (and 'getAccessToken' in the PHP SDK will only work when real users log in, it can't fall back to the app token)
If you were attempting to use the app access token to read the page's feed, this would fail in the manner you described.