Unsupported get request only when using app token - facebook

When requesting /703889222997557 via the Facebook Graph API, I am receiving the error "Unsupported get request." But this only occurs when using an app token. When I use the "standard token" you get when opening the Graph API Explorer, the request is successful. As soon as select an App in the Explorer and use the App Token, the request fails again.
Any ideas what the problem might be here?

Related

Facebook Graph API Service Temporarily Unavailable Error

I am trying to connect a bot to Facebook messenger, using Facebook developer tools.
https://developers.facebook.com/
I've created the Facebook app, and it's sent me the webhook to my server. However, when trying to call the Graph API when sending a message back to the user, I receive the following error:
FacebookMessaging:400 : {
"error": {
"message": "(#2) Service temporarily unavailable",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AIWsRyUmPFnySGwb1Rgl4P6"
}
}
POST API,
https://graph.facebook.com/v10.0/page-id/messages?access_token=token
JSON
{recipient:{id:"id"}, message:{ text:"message"}}
I suspect it could be because my app is unreleased, but I'm trying to test it beforehand. Is there any other explanation for this, or how are you suppose to test an app before releasing it?
The same code is working for an older Facebook app that is released.
The issue was that the API call was missing the access token. Stupid mistake, but unusual error for missing the access token.
I already try and reproduce this problem. May be you use wrong access_token in this case. When you want to send the message by page, use should use page access token instead of user access token
Check out the diff here: https://developers.facebook.com/docs/facebook-login/access-tokens/
And flow here for get page access token: https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
It is clearly return you the response with type as OAuthException. If you find this error type in facebook garph api error handling documentation. You can see the first line of error codes is OAuthException. Also it is written there the resolution of this type of error in what to do column is, If no subcode is present, the login status or access token has expired, been revoked, or is otherwise invalid. Get a new access token.
If a subcode is present, see the subcode.
Well it is nice to see you get the answer on your own.

facebook app access token mismatch error

I am trying to send notifications to users via facebook canvas app(SDK 5). My notification code
$response = $fb->post('/userID/notifications?access_token='."$appAccessToken".'&template="test template"&href="test htrf"');
But I am getting an error "Uncaught exception 'Facebook\Exceptions\FacebookSDKException' with message 'Access token mismatch. The access token provided in the FacebookRequest and the one provided in the URL or POST params do not match"
I have checked the app access token in graph api explorer and its working fine! I tried to reset the app secret but same error
graph api explorer have no problem with the app access token but when i try to paste the app access token it in my code it shows the error.
I have tried to make app access token by combining app_id|app_secret but no luck.
am i doing it wrong?
Thanks

Facebook Graph API: getting an access token with an app ID and secret

https://developers.facebook.com/docs/facebook-login/access-tokens/:
Here is what I put in my browser:
https://graph.facebook.com/?endpoint&key=value&access_token=[THE APP ID]|[THE APP SECRET]
Here is the result.. an error message:
(#803) Some of the aliases you requested do not exist: endpoint
Help!
Goes to "https://developers.facebook.com/tools/explorer"
Copy the code of "Access Token"
I use "Access Token" as Token for Rfacebook Packages. and it works.
Hope it can work on your side.
The error told everything : endpoint alias does not exist.
If you want to generate the Facebook access token to test, just use the Graph API Explorer:
https://developers.facebook.com/tools/explorer
Or, you should use Oauth process to grant the Facebook app to get access_token.

App Access Token can't retrieve Test Users?

I can't get the list of my test users with my app access token. First I get the app access token with the following graph api call:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
which succeeds, I get an access token in the format
APP_ID|SomeRandomCharacters
Now I try to get my list of test-users using the following graph API call:
https://graph.facebook.com/APP_ID/accounts/test-users?access_token=APP_ACCESS_TOKEN
however, I get a "bad URL" error in my iOS code.
If I try to go to that address directly in a browser I get HTTP 400 Bad Request and if I try it in the Graph API explorer, I get
{ "error":
{ "message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Check your app isn't defined as 'Desktop/Native' - if it is, your app secret is considered untrusted for API calls that can change the app's settings (including Test Users)
The assumption is that the app secret has been distributed with your native app and can't be trusted.

Facebook access token graph API call result in a bad request error

We have a Canvas Facebook App and for some time we get a strange error for some of the users that are trying to install (allow) our Facebook app. I mention this is happening only for some of the users and not for all! The error we are getting is "The remote server returned an error: (400) Bad Request." The graph API call we putted in a try catch block and this is what the logs says when I searched over them to see what went wrong. The graph API call is:
https://graph.facebook.com/oauth/access_token?client_id=XXX&redirect_uri=XXX&client_secret=XXX&code=code_received_from_facebook.
We received the code from Facebook and append it to the graph API call from above but it seems that for some users this is not working. Our redirect_uri parameters contains an URL to our Facebook App and contains also some parameters (example: http://apps.facebook.com/our_application_URL?cid=xxx&surveyid=xxx&messageid=xxx).
xxx = some values.
Did some of you confront with this kind of strange behavior? Working for some users but for other is not working? We are using the same code so nothing change between a successful installation and a unsuccessful installation.
Thank you for your help in advance!
Now that Facebook require SSL for applications your "redirect_uri" need to be https (i.e https://apps.facebook.com/myapp/), otherwhise you will get "Bad Request".
You probably got the error for only the users that had forced SSL but not the rest.