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.
Related
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.
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 created an app and added 16 test users in the App interface. I made it so 5 of those users weren't affiliated with the app and the other 11 were. I had one user become friends with the other 15. I then tried various ways to retrieve a listing of a given user's friends.
https://graph.facebook.com/{RANDOM USER ID ON OUR APP}/friends?fields=installed&access_token={OUR APP ACCESS TOKEN}&format=json
yielded this
{
"error": {
"message": "(#604) Can't lookup all friends of {RANDOM USER ID ON OUR APP}. Can only lookup for the logged in user or the logged in user's friends that are users of your app.",
"type": "OAuthException",
"code": 604
}
}
FQL wasn't any better.
https://graph.facebook.com/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1={RANDOM USER ID ON OUR APP}&access_token={OUR APP ACCESS TOKEN}&format=json
yield this
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException",
"code": 102
}
}
I understand what's happening here. These calls are attempting to retrieve all friends of the user in question and as some users aren't members of the app I'm not allowed to make this call. So I need to make a call that allows me to get just the friends that are members of the app if that's possible.
You need to use the user access token to gain access to the users information.
Btw, you cant do that anymore in 2.0
Take a look here.
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/