Facebook Access Token Invalid for search endpoint - php

i am making this request through graph api and i am getting this error:
(#200) Must have a valid access_token to access this endpoint
A couple of days ago i was making the same requests without any problem and now i keep getting this error messages, i don't know why. the query i am requesting is the following:
/search?q=SOMETHING&type=event&fields=id,name,description,cover,start_time,end_time,location,owner,venue&limit=5000&access_token=ACCESS_TOKEN.
This query works on graph api explorer (including the access token). My question is, the error is mine or from facebook?
Thanks.

Put the Access Token in the Debugger and check if it´s valid: https://developers.facebook.com/tools/debug/
If yes, file a bug: https://developers.facebook.com/bugs/

Related

Facebook graph api returns "Unsupported get request" when I try to get a post data created by my app using the post user access token

I have a Facebook application that posts on behalf of the users (approved by Facebook), According to the graph API documentation I should be able to call
/{post_id}?access_token={PostUserAccess_token}
In Documentation, in Permissions paragraph, there is written:
A user access token can read any post your application created on behalf of that user.
I'm using the same post id (ex: XXXX_YYYYY) returned after the post, and the user access token to make the call but I get this error:
"message": "Unsupported get request. Please read the Graph API documentation at ....",
"type": "GraphMethodException",
"code": 100,
Any idea what are the possibilities of this to happen?
The same thing is happening to me. This GET request was working a few days ago. I think the problem is with the Graph API.
Whats funny is that you can make POST request with the same parameters (you have to add something to change like message='TEST') and it will allow you to edit the post if you access token is working.

FacebookAuthorizationException' with message Unsupported get request - Facebook PHP API

This url:
https://graph.facebook.com/v2.2/389546181070007/feed?access_token={token}&appsecret_proof={secret}&fields=name
And:
https://graph.facebook.com/v2.2/186726524843032/feed?access_token={token}&appsecret_proof={secret}&fields=name
have both valid pageID's and the same access_token and appsecret. The token I'm getting with:
https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret={app_secret}&grant_type=client_credentials'
Yet the first one throws an exception and the second one works fine and returns the feed list.
The exception thrown is: FacebookAuthorizationException' with message 'Unsupported get request.
Have tried to use a different app and more things... been struggling with this issue for 6 hours now.
Has anyone any idea how it is possible that one page works and the other doesn't?
When I try to visit the first page on Facebook, I only get “Sorry, this page isn't available”.
That means that either that page is not published yet, or has some access restrictions in place. In both cases, you can not “see” it via API, when you use an app access token.
You will need to use either a page access token for that page, or a user access token for a user that has the right to see the page.

Facebook Graph API: What is the access token used?

I am attempting to access a status/photo summary of a facebook Post. I attempted to use graph explorer tool to get the summary, which is successful.
Now what happens is I have an app, which has the same permissions I've given to the graph explorer tool (user_status, user_photos). I then build a URL like this:
https://graph.facebook.com/{post_id}?access_token={my_app_access_token}
The access token I'm using is obtained from this link, but all I get is an error. Am I using a wrong access token? If I am, how should I be getting the correct access token?

Generating a monthly "Post Count" from Facebook API

I am trying to figure out how I can query the FB Graph API (or FQL API) to be able to get number of posts (or status-updates) for a given period of time. I am able to generate an access token using
$access_token = $facebook->getAccessToken();
So that would lead me to believe that the PHP SDK is installed correctly and working. When I try to use the access token in a fql query it fails giving an error message of: A user access token is required to request this resource. The query I'm trying is just to return the current status_id. I tried using uid=me() as well as using an actual user id (testing id from the API). Here is the query url:
https://graph.facebook.com/fql?q=SELECT+status_id+FROM+status+WHERE+uid=me()&access_token=
I'm not sure where I'm going off track with this, so any help would be greatly appreciated.
Thank you for looking.
This is your app id and secret, please do not ever post this to public, anyone will have full control of your application. Reset your token immediately
The PHP SDK defaults to the application access token (which should never be posted in public). You need to have the user login with getLoginUrl() an example is given at
https://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php

Why would Facebook OAuth token suddenly become invalid?

I'm using Facebook's PHP SDK, and it's been great so far. However, I have a weird issue on one page. On this page, I make a call to the graph API, then later a call using FQL. On the second call, however, I get an "Invalid OAuth 2.0 Access Token" exception. Why would the token become invalid while the first call worked? I also use FQL (same exact query/code) elsewhere in my site, and it works just fine. Does anyone know what would cause this?
Update: First call is a graph call (/me?fields=email).. second is querying for current user's affiliation, if that helps.
Could be one of several things, but if I had to hazard a guess, I'd say that you're trying to access something out-of-session, and your oauth token doesn't include the offline_access permission for the resource being accessed.
Perhaps some more detail about the nature of your API calls/FQL queries would help us narrow it down.

Categories