OAuth authentication error in Facebook graph api - facebook

Using graph API graph.facebook.com/103284669756289_575801289171289
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104,
"fbtrace_id": "E9N1FZBirds"
}
getting this response while fetching particular id detail.

https://developers.facebook.com/tools/explorer/
Use Graph API Explorer from Facebook to test your API calls.I think your access token is missing for this call.
Its done. You just have to access_token in URL.
https://graph.facebook.com/103284669756289_575801289171289?access_token=ACCESS_TOKEN

Related

Getting facebook user information using AccountKit access token via Facebook Graph API

I was using access_token from FB AccountKit, but it seems that the access token from facebook account kit are not the same as Facebook's Graph API access token
Output from https://graph.accountkit.com/v1.1/me?access_token=THE_ACCESS_TOKEN shows correctly
"id": "1581612245187273",
"phone": {
"number": "+628979291xxx",
"country_prefix": "62",
"national_number": "8979291xxx",
},
When I use the same id from above as userID and THE_ACCESS_TOKEN as accessToken using Facebook SDK
fb.Get(`/` + userID, fb.Params{
`fields`: `name,email,birthday,gender,hometown,languages,location,religion,picture`,
`access_token`: accessToken,
})
It shows:
"error": {
"fbtrace_id": "GKBnPt6ZdMm",
"message": "Malformed access token",
"type": "OAuthException",
"code": "190",
},
Is my assumption correct? (that AccountKit access token is not the same as Facebook Graph API token)
How to get the facebook user information when you have only account kit access token? or it's not possible at all?
Account Kit uses a different graph from the Facebook graph and different access tokens. Accounts created with Account Kit are not linked to Facebook accounts. You can use the Account Kit access token to query the Account Kit graph API to find the phone number or email and accountID.

Getting feeds from Facebook groups using Graph API HTTP requests

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.

Facebook Graph API, Unable to get user profile

When I http using graph API explorer in the context of "Graph API Explorer", I am able to query user information as -
/v2.0/{user-id}
when I http in the context of my app, I see the response as:
{
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100
}
}
Permission lists are same both on Graph API Explorer as well as my App:
user_about_me
user_activities
user_birthday
user_events
user_friends
user_likes
user_location
user_photos
user_status
user_videos
email
publish_actions
read_friendlists
read_stream
I regenerated a new access token and tried different sets of user ids and it seems to be working now.

Access User's Friends with only App Access_token in facebook

As mentioned in Link an app can access user's friend's id with an app access_token. But when I try to access friends of a user by
www.graph.facebook.com/USER_ID?fields=friendlists&access_token=ACCESS_TOKEN
I get an error:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
How can I access a user's friendlist with only app access token?
Did you try the field "friends"?
https://graph.facebook.com/USER_ID?fields=friends&access_token=ACCESS_TOKEN
If you requirement is just to fetch user's friends and their facebook ids, you can get them here.

How to get statuses of a random facebook page through Graph API

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/