I'm trying to get the statuses of a facebook page. For this I need an access token, which I can obtain by this:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&
grant_type=client_credentials
(Found here)
But when I try to access the graph api manually, with the access token, like this: https://graph.facebook.com/id_of_page/statuses?access_token=my_fresh_access_token, I always get this error:
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
Are there different 'kinds' of access tokens? Or what am I doing wrong?
There are several access tokens on Facebook.
The access token you are receiving is an app access token which is more limited than the user access token.
The access tokens available are explained here under 'Access Token terminology': https://developers.facebook.com/docs/authentication/permissions/
Related
My web-application need to fetch posts from facebook and save content in pages.
I'm have developer account with business access (authomatically contains permissions pages_read_engagement).
I'm try to get API-key by request: https://graph.facebook.com/v8.0/oauth/access_token?grant_type=client_credentials&client_id=****&client_secret=***
API return me access token and token type:
{
"access_token": "|", "token_type": "bearer" }
After that i try to get feeds via request: https://graph.facebook.com/APP_ID/feed?fields=is_published,id,attachments{title},message,created_time,full_picture&access_token=***&appsecret_proof=***
But API return me error:
"error": {
"message": "(#10) This endpoint requires the 'pages_read_user_content' permission or the 'Page Public Content Access' feature. Refer to https://developers.facebook.com/docs/apps/review/login-permissions#manage-pages and https://developers.facebook.com/docs/apps/review/feature#reference-PAGES_ACCESS for details.",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "AbApv_PjRlplW2Abv61zNCx" } }
I'm trying to get a long-lived user access token, and it worked correctly, but only 60 days and blocked, Then I have to restore it manually.
Account with API is administrator of group and Page read content should work
Support replied that the rights pages_read_engagement will be enough, recommended to change the API version to 10.0, but it did not help. What am I doing wrong?
I tried to use the app key, but it does not work, you need to use the user access token (which has restrictions), or create a system user (which no longer has such restrictions)
I'm create the system user and use his API key.
I would like to integrate my APP with some existing groups in Facebook.
So, for that, I would like to be able to read people's posts.
I have tried the following HTTP request to Facebook's graph API:
http://graph.facebook.com/v2.5/192992880732335
But it responds with the following:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104,
"fbtrace_id": "By+n1YSvvrI"
}
}
How can I get an access token to a specific group?
It is pretty ease to get all the feeds from that group.
Just add the access token from some user and your are done:
https://graph.facebook.com/v2.5/192992880732335/feed?access_token=<ACCESS TOKEN>
To get the access token, it is just a matter of calling
FB.getAuthResponse().accessToken
after user's login.
I'm trying to get videos of facebook page using facebook graph api.
I get it to work when I use my personal access facebook accounts access token but if I try to use my apps token it returns
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
Is there way to get pages public videos from the api by using app token?
If not, is there way to use just my personal access token and renewing it automatically without requiring the user to login. (Server would always make the request with MY OWN access token, not their)
I'm trying to access a facebook page's conversations using the graph api.
Accessing the page itself (with /{page_id}) is fine, but I get on oauth exception for the conversations.
My request in the graph explorer is this one :
/{page_id}/conversations where {page_id} is, well, the page id :)
and the error is
{
"error": {
"message": "(#10) Application does not have permission for this action",
"type": "OAuthException",
"code": 10
}
}
According to the documentation, the required authorization is read_page_mailboxes, which I granted. Here are the rights of my token as shown in the oauth debugger :
public_profile, basic_info, read_page_mailboxes, manage_pages, user_friends
Are there other permissions I'm supposed to require ?
In fact, just asking for the permission itself is not the right way to access to this page informations.
You have to recover the page access token located at /{page_id}?fields=access_token and use this token in order to access the conversations.
I want that everyone can send a message to a friend after the user is logged out from facebook.
So I save the access token but when I logout from facebook, then facebook tell me that the token is expired because the user is logged out.
Maybe do I have to request some particular permission ? I know that offline_access permission is deprecated... so what do I have to do ?
This is the error:
"error": {
"message": "Error invalidating access token: The session is invalid because the user logged out.",
"type": "OAuthException",
"code": 190,
"error_subcode": 467
}
P.s. I am using JS SDK but I think that this doesn't matter.
You will have to extend you access token, have a look at this :
http://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/
Facebook reference how to handle offline_permissions:
http://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/
You should be able to manage.
#Alexandre Couturon Reference :
If you get an Access Token client-side (JS SDK) you will get a short-lived token. You can exchange this token for a long-lived one with the exchange oAuth endpoint:
https://developers.facebook.com/roadmap/offline-access-removal/