Facebook Graph API - My access token fails for 1% of public Event requests? - facebook

I'm using my FACEBOOK_APP_ID|FACEBOOK_APP_SECRET access token to get events data from facebook.
It works for 99% of events :)
But, it fails on 1%, even though they are public events
I cannot spot any difference between the events that fail and those that succeed.
when trying in the FB Graph Explorer, these requests work fine with the default access token, but do not work with my access token.
the same events work/dont-work with my token in the Graph Explorer as in my php code.
I've tried creating a new facebook application with new access token and the same behaviour occurs.
This event, like almost all, works with my token:
https://www.facebook.com/events/1358567590825431/
This event doesn't work:
https://www.facebook.com/events/481398338716859/
Graph returned an error: Unsupported get request. Object with ID
'481398338716859' 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
Does anyone have any idea what's going on here? Is this a bug with facebook or am I doing something wrong?

Related

Facebook graph "/me/photos" endpoint requiring 'Page Public Content Access'

We've had a facebook app which access the authorized user's photos. It uses user tokens.
It had been working for a long time. In the last few days, requests to the graph endpoint me/photos has started giving us an error stating the endpoint requires 'Page Public Content Access'. I can also reproduce this in the graph explorer. Note: it only occurs if I refresh user token, the older tokens seem to work.
We're not attempting to access a public page so this error doesn't seem to make sense. We're only accessing the "me" page and the user token has the user_photos permissions.
Is this error a facebook bug? Do we need to change how we call the graph? Do we need this permission (would prefer to not request it since it doesn't sound applicable to a user-token based app accessing "me" page).
Thanks in advance.
Exact API and error can be seen below:
Weird glitch, and one I can’t personally reproduce.
(And even if the token was a page token, that error would not make sense. /me with a page token automatically resolves to the page the token is for, so this could not be “public access” to begin with.)
There’s already a bug report for this, https://developers.facebook.com/support/bugs/315161742450138/ - though it is currently in “needs more info” status. Maybe subscribe to that, then you will get updated when there’s anything new on this. And you can also comment there, if you have info to add.

Facebook permissions changed. User_photos no longer sufficient. 'Page Public Content Access' addition [duplicate]

We've had a facebook app which access the authorized user's photos. It uses user tokens.
It had been working for a long time. In the last few days, requests to the graph endpoint me/photos has started giving us an error stating the endpoint requires 'Page Public Content Access'. I can also reproduce this in the graph explorer. Note: it only occurs if I refresh user token, the older tokens seem to work.
We're not attempting to access a public page so this error doesn't seem to make sense. We're only accessing the "me" page and the user token has the user_photos permissions.
Is this error a facebook bug? Do we need to change how we call the graph? Do we need this permission (would prefer to not request it since it doesn't sound applicable to a user-token based app accessing "me" page).
Thanks in advance.
Exact API and error can be seen below:
Weird glitch, and one I can’t personally reproduce.
(And even if the token was a page token, that error would not make sense. /me with a page token automatically resolves to the page the token is for, so this could not be “public access” to begin with.)
There’s already a bug report for this, https://developers.facebook.com/support/bugs/315161742450138/ - though it is currently in “needs more info” status. Maybe subscribe to that, then you will get updated when there’s anything new on this. And you can also comment there, if you have info to add.

Unsupported get request error (code 100) with Facebook Graph API Ads reachestimate call

When making requests to the reachestimate endpoint in the Facebook Ads API (v2.4), we are receiving an "Unsupported get request" error (code 100) for some users, whereas it works for the majority. Here's what I know:
The requests are well-formed. We are providing the access token, ad account ID, currency, targeting spec, and API version. Except for ad account ID and access token, the parameters are identical between working and non-working requests.
According to the access token debugger, the access tokens are valid, never expire, and contain the ads_management scope.
I am able to use the same access token to successfully retrieve the Facebook page being promoted.
One theory was that perhaps the users did not have permission to view the pages that were being promoted. To test this, I added an alcohol restriction to one of the pages for which the reachestimate call did work, and changed the user's age to 20. I also blocked the country in which that user was located. The reachestimate call continued to work for that user, so thus that did not reproduce the issue.
Facebook seems to be providing a generic error that does not help determine the problem. I'm looking for any other ideas as to what it could be or how to identify it.
I recommend you to file a bug at https://developers.facebook.com/bugs/
And you should attach the full response including a field called fbtraceid in the bug. In this way we are able to looking to what happened to you.

Facebook Login As App, access token doesn't work

I am trying to get events from a Facebook page via Ajax.
But there should be no login process for user. For this reason I am trying to implement "Login as an App" by following the the documentation on this page.
I am getting the access token correctly by
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID
&client_secret=YOUR_APP_SECRET
&grant_type=client_credentials
However when I try to query Facebook Graph API with this access token I am getting an empty result set.
This is an example request;
https://graph.facebook.com/FAN_PAGE/events?access_token=ACCESS_TOKEN
I know the result set should not be empty because the same request with Graph Explorer returns the correct values.
Even a request like https://graph.facebook.com/FAN_PAGE/events?access_token=ACCESS_TOKEN_FROM_GRAPH_EXPLORER works correctly.
Any idea on whats going on? How can I get this to work correctly?
Actually the reason was not about the access token. The reason is that the page I want to get the events for is restricted. This works fine for unrestricted pages.
After a little research I found out that to read a restricted page's events (or posts etc.) you need a user access token. You get this by asking the user. (at login flow)
The other solution to get this data without prompting for a login is to get "page access token". You can generate a page access token by following this link.
And more on Access Tokens

Facebook Event Search - Access Token

A while ago I had written some code that searched Facebook events using the api. I've been trying to revive that code but have been unsuccessful. The main difficulty I see is that is that searching for public events now seems to require an access token. The documentation (https://developers.facebook.com/docs/reference/api/event/) says that shouldn't be the case until July 5th but, the sample event search for me (https://graph.facebook.com/search?fields=name&q=conference&type=event) returns nothing if you don't have an access_token.
So I got an access_token for my application using the facebook php sdk $facebook->getAccessToken(). The problem I am now suffering is this seems to be the wrong type of token. It doesn't work to return any events and the query when posted into the url bar doesn't get anything, but if I switch it an access token generated by a learn graph api link the query works in the url bar (but not from my site annoyingly enough). The type of access token I'm getting from the app is basically | and that is the type that is not working for the event search.
I am basically looking for any advice I can get. How to get an access token that the event search will accept would be helpful. I also find it weird that I can do an event search using the url bar but, the exact same query through my app returns an empty array. So basically anything that can shed some light on my problems would be great.
UPDATE:
I got everything working except that it still requires a user access token rather than an app access token (or none). My other problem was caused by an oddity in the php sdk and I was able to solve it by just doing the curl queries myself.
I have the same problem, at this moment I'm using the access token the graph API explorer (https://developers.facebook.com/tools/explorer) uses when my app is selected (I think it's the users's token so the app can beave as the user, and since it's my access token it's not a big deal).
But this raise another problem: I think the token gets invalidated by logging off from FB or anything similar.