Facebook Graph API "/{page-id}/feed" is not working with App Access Token - facebook

We are facing issues with Graph API. The Facebook Graph API "/{page-id}/feed" is not working for all pages with a valid App Access Token. Previously it used to work. We noticed it today the API is throwing error
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1
}
}
Not working pages:
https://graph.facebook.com/22934684677/feed?access_token=
https://graph.facebook.com/42798291365/feed?access_token=
Note: And its working if we pass a User Access token instead of App Token.
Facebook developer Docs says "An access token is required to view publicly shared posts." So App Access Token should work!
Does Facebook change something inside the API?. Can any one help to solve the issue

You should use a Page Token for Page data. Pages not working with an App Token are most likely restricted by age or location. Since the App Token does not include any user session, you canĀ“t be sure if the user should have access to it.
If it does not work with an App Token AND the Page is definitely not restricted, file a bug.

This is happening because some of the posts returned might have extra restrictions on them which need a user token to verify this. Use a page token or a user token as a workaround for this. Having said that, the request shouldn't fail with an unknown error and we're working on a fix for the same on the bug report here:
https://developers.facebook.com/bugs/783169051760311/

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 API returns "Invalid OAuth access token signature."

For my website I use the Facebook API to get the events from a few Facebook pages. For this purpose I have created a Facebook app.
However, even though this used to work before, the API now returns an error:
"message": "Invalid OAuth access token signature.",
"type":"OAuthException",
"code": 190,
Here are the steps to reproduce the error:
Go to app's dashboard on https://developers.facebook.com/apps
Get the app id (APP_ID) and the app secret (APP_SECRET)
Use the app id and the app secret to get an access token by using this url:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID
&client_secret=APP_SECRET&grant_type=client_credentials
This returns something like
{"access_token":"123412342134|f34f34f32fc3rc4rc324r-X","token_type":"bearer"}
I then use this access token to access the events
https://graph.facebook.com/v2.12/{11239244970}/events/?fields={id,name}&access_token={123412342134|f34f34f32fc3rc4rc324r-X}
However, this returns the error mentioned above, "Invalid OAuth access token signature.".
I'm stuck here. None of the posts on here seem to solve my problem.
I've already tried resetting the app secret, but that didn't help. Any hints are greatly appreciated!
It would appear that the reason for this error is that Facebook currently only returns events for pages using the Pages API if you use a user access token and that user is attending, is interested in or has been invited to the events of the page (as answered by #unknown_b to a related question over here).
To get the Client Access Token for an app, do the following:
Sign into your developer account.
On the Apps page, select an app to open the dashboard for that app.
On the Dashboard, navigate to Settings > Advanced > Security > Client token.
https://developers.facebook.com/docs/facebook-login/guides/access-tokens#errors

Facebook open graph says access_token needed

I'm trying to post the following the facebook Graph API explorer.
cody.short.94/notifications? access_token= {User Access Token} &template= this is a test &href= www.test.com
I want to be able to send the user a notification, but all attempts have failed. I'm currently getting this error:
{
"error": {
"message": "(#15) This method must be called with an app access_token.",
"type": "OAuthException",
"code": 15
}
}
I'm not sure what is causing it, and I'm in need of some guidance. Any help would be appreciated. note: my app is currently marked for web so that it not the problem
See, the error is quite self-explanatory :
This method must be called with an app access_token
The Notifications API use the APP Access Token, not the user access token!
The App Access Token is: APP_ID|APP_SECRET or get directly from here for testing. (Make sure of the security of this token, this is very crucial and just like a password to your app)
Now test the query with Graph API Explorer , and remove the user token from the Access token field and replace it with the App Access Token
It will look something like this-
Make sure you paste the app access token APP_ID|APP_SECRET on the top field that says Access Token

Facebook session expiration error when try to post actions to open graph using 'App access token'

I am facing this error with some of my users, the case is as following:
I use facebook "App access token" to post actions to facebook Open Graph instead of the user access token because app access token don't expire according to facebook documentation unless you refreshed the app secret, I use the follwoing Post url to post actions
https://graph.facebook.com/user_facebook_id/App_Namespace:action_name?FBOG_Object=FBOG_OBJECT_URL&access_token=app_access_token
Some of the actions do appear on facebook, but for some users the actions fails to post and return the following message:
{ "error": { "message": "Error validating access token: Session has expired at unix time 1345759200. The current unix time is 1345925578.", "type": "OAuthException", "code": 190, "error_subcode": 463 } }
What am I doing wrong? Why do I have an expiration error although am using the app access token? Should I worry for user permissions?
After checking the servers it seems that the code that uses the app token was not deployed and the code that uses the user token is still there.
The app token does not expire unless the app owner took some action.
https://developers.facebook.com/docs/authentication/applications/
Error message clearly shows that your access token expired and you need to get another one.
However you can handle this issue : Access token expiration
Also if you are looking for a long life token you need to provide some more parameters while authorizing the application to a new user.
offline_access parameter can be included in a request but now it's been deprecated by facebook. Removal of offline access

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.