facebook api get friends likes returns empty array for some friends - facebook

i tried this with fql and the test console
https://developers.facebook.com/tools/explorer
checked the permissions
check with two accounts (no privacy issues)
checked the fb bugreports
clicking on friends then a user id then likes returns an empty array on some of my friends. i couldnt figure out why this is the case.
it seems to be pretty random but maybe i overlooked something
can someone help me on this?

If some person means Your app works fine for facebook developer account and other accounts not - check on You facebook developer account Status & review if Your app is On for public and not blocked for review.

Related

Facebook GRAPH API - user's friends list does not return any data except total count

I created several test users in my App in Facebook developer account and granted all of them user_friends permission and also connected them together through 'Manage user's Facebook friends' option. However when I try to retrieve one of those user's friends list, it returns only total count of friend, but not their data .. Does anyone know why is that happening ? Thank you in advance..
Test users list
me/friends request and response
Granted permissions to test users
Its a known bug of Facebook which has been reported here for app type Consumer/Business.
https://developers.facebook.com/support/bugs/721152122632278/
https://developers.facebook.com/support/bugs/615773773588521/
But you won't have any issue if your app time is Gaming Service, or you create a test app of your main app but don't forgot to create test users, assign them 'user_friend' permission and add them as a friend with each other. I followed the same process after going through alot of research and finally it worked.

How can I tell if someone is a friend of mine in Facebook Graph API V2.0 and above?

In my App, I go through different groups and pages, and check public posts that were posted by people that haven't installed my App.
How can I tell if a person that posted something is a friend of mine or not?
I am well aware that \me\friends returns only the list of friends who also installed my app, I don't want to get the full list, only check a specific person.
I am also well aware that Facebook currently returns app-scoped Facebook ID of a user of enters my application, but also returns public data about people using their non-app-scoped FB ID - however without this simple piece of info.
Thanks in advance
Unfortunately this is not possible until both persons have given your app the user_friends permission.
See
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends#readperms
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/friends#readmodifiers
You can't. The other user needs to login to your app and approve user_friends permission to your app. Otherwise it means they they have not approved it and you will not get the information

How to know if user's facebook's friends are registred on your site?

I want to create a 'Find friends from facebook' button on my site. Many websites have it, and it basically gets your friends from facebook and identifies those of them who are already registred on that website, to allow you add them as friends or whatever.
I have clicked that button on a very famous website and the website show me a list with my friends who are registred on that website, and almost 1/3 of my friends where there.
I have been reading the facebooks API, have created an app, and finally managed to create a 'Find facebook friends' button. But when I click on that button, my website receives from facebook only an array with the name and fb ID of every friend I have.
How is that usefull for me? How can I know who of them are registred on my website to show it to the user that clicked the button? I thought it should give me for example the email of each friend, so I can compare it to my DB and get the registred users, but, now that I think of it again, it's true that it is impossible due to several fb privacy violations.
How do those websites know who of your friends are registred by clicking the button?
Thank you very much!
You need to associate a user's Facebook ID with their account on your site (in the user DB table for example).
Then you have the list of all Facebook IDs of your friends. You can run a query in your DB to see which of your registered users' Facebook IDs match the ones from your query.
Basically the intersection of 2 list of FB IDs.
The ones in both lists are your friends registered on the site.
If you're happy to add an extra permission to your FB authentication (publish_actions) then you you don't need to keep your own list of users in a DB to get this info - you can query the scores API for the app. Just make a Graph call to /APP_ID/scores and it will return a list of friends of the current user who are using this app. Your application doesn't even need to publish any scores info - in this scenario, the API will just return scores of 0.
The addition of publish_actions does mean that there will be an extra permission dialog appearing when users connect to your app/site if you are not already requesting this permission.
Only friends who have given your app/site the publish_actions permission will be shown in the list - so if you have an existing site and have not previously requested this permission then friends who are old users will not be shown. Totally understand this might not be suitable for you and perhaps you should implement Fabien Warniez's solution instead.
Javascript example:
FB.login(function(response) {
FB.api('/145634995501895/scores', function(scoresResponse) {
$.each(scoresResponse.data, function(key, value) {
console.log(value.user.id + ':' + value.user.name);
});
});
}, {scope: 'publish_actions'});
Replace 145634995501895 in the above code with your application ID.

Facebook API - FQL url_like table behaving strangely for some users, not returning all URLs liked

I am writing a facebook API based app and I ran into a few complications with the URL_like table in FQL with certain facebook accounts
If I run the following query, I expect to get back a list of URLS including web pages on which I have clicked the "like" button:
https://graph.facebook.com/fql?q=SELECT+url+FROM+url_like+WHERE+user_id=me()&access_token=TOKEN
However, on my own personal facebook account (the same one I registered the app with), when I run the query, the URLs that show up are only URLs i liked "inside" facebook - URLs that were posted on my wall, or other peoples walls, but not urls that I visited and clicked the "like" button on.
At first I thought this was an issue with account or privacy settings. I adjusted the settings on my facebook account to match the exact settings that my friend had on his facebook account which showed the correct results of the FQL query, but it still gave me the result above.
I deleted the app from the list of approved apps, approved it again, thinking this would change the result with a different access token, but it has not.
Also - this functionality worked correctly on my facebook account before, which makes the predicament even stranger
So here is the question - does anyone know why only certain URLs show up in the URL_like table? was there a change in the facebook API to justify this? Can this error be repeated? Or is my profile just some sort of super glitch?
Thanks in advance, I am at my wits end with this

Facebook access_token for stranger account

is there a way to get an access_token to get a stranger account photos, albums and friends?
As i can see you can get (with the right access_token) all the information belonging to you and your friends using:
https://graph.facebook.com/[User_ID]/friends?access_token=[A_T]
https://graph.facebook.com/[User_ID]/albums?access_token=[A_T]
https://graph.facebook.com/[User_ID]/photos?access_token=[A_T]
what about the friends of your friends and perfectly stranger? Are they reachable in such a way?
I ask this because using the normal browser i can get the public photos of unfriend account, so i thought that can be a way to get that information through the API.
It is not possible, the facebook privacy is to tight to do such a thing.