Facebook app token not working, but access token works - facebook

I have a really weird situation here, and I've looked everywhere through Facebook's documentation with no answers.
I'm trying to get get recent posts from multiple Facebook pages. But one of them keeps crashing. It won't work when I'm using an app token. It works if I'm using access tokens, but those expire, so it'd be better to not use that.
https://graph.facebook.com/norgeshushonefoss/posts?access_token=myAppToken
gives this result:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
While this url gives me the recent posts: https://graph.facebook.com/norgeshus/posts?access_token=myAppToken
I can't see any difference in those two. Are there any page settings that may cause an app token not to authorize for some reason?

If the page has any access restrictions in place (age, location, alcohol-related content), then you can not access any of its info using your app access token.
It needs a user access token for a user that qualifies to see the page (or a page access token).

Related

How to get overall star rating of Facebook page from Facebook Graph API?

I am trying to make a very simple request to Facebook's Graph API using this URL:
https://graph.facebook.com/v2.12/1984193321812400?fields=overall_star_rating&access_token=205658113371329|gYdP-nDHNVENlwVxria21Uczgs8
All I want from Facebook is the overall_star_rating of my Facebook page. However, this is what I get:
{
"error": {
"message": "(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/206742313468873/",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "A9XRfTkh3WR"
}
}
Since I am completely new to Facebook Graph API: Is the request I am making correct or am I missing something really fundamental here?
And yes, I read Facebook's issue report, but I don't find it very helpful since I set my app to active already and it's not working anyway.
Thanks for any help in this matter.
Since Facebook is undergoing major changes, they have revoked few access to non active apps. Get the access_token from any frequently used app, your Graph API call is pretty correct!
But the Page ID seems to be wrong, as it shows me error after adding a working token.
Error : "message": "(#803) Some of the aliases you requested do not
exist: 1984192327815400"
After changing the Page ID, and adding active app token, it shows the correct result.

Facebook Business page - Unsupported get request

I have admin access to a Business Facebook page, I created an app under the same account, when I then try to use the Graph API Explorer under that application using the access token generated I get:
get/v2.5/{client-name}/
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
I have full access so I do not know why I am getting a error. This normally works fine when I try it on a standard Facebook page, is there something extra I need to do for Business pages?
Since you are trying with an App Token, i assume that the Page is restricted by age or location. In that case, you have to use a User Token or Page Token of a user who is allowed to see the Page and its content.
More information about Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/

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

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/

Receive correct access token

At the moment, I try to query the Facebook Open Graph Api.
My problem is the following:
Calling: https://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret results in
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Also when I first receive an access token and use it, the same error appears. In the case, that I use an access token which I receive from the Graph API Explorer, everything works fine. https://developers.facebook.com/tools/explorer)
Comparing the access token I receive from Facebook and the access Token of the Graph API Explorer I see a difference in the length because the second token is much longer. (I think its a session token if I am not wrong)
How can I get such a token in order to do the mentioned API call?
Your appId and secret are used to generate your access_token, they aren't actually the token so there's something wrong with your process. Some sample code might help determine where you're going wrong. Though please don't actually post your appid and secret here.
https://developers.facebook.com/docs/facebook-login/overview/#loginflows
You haven't stated what language you are using, but there are a number of SDKs out there already that will simplify this process.
At the bottom of the above page, there are a number of links that will walk you through the login process for different platforms so I suggest you take a look at these

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.