Getting the wrong Facebook Id in the AuthData Parse.com - facebook

I facing a problem when trying to get Facebook friends list.
When user login Parse restore on the user AuthData a wrong (temporary) Facebook id, and than when I'm trying to pull the friends list I can't get it since the Facebook id is not the "real" Facebook id.
I'm getting all right permissions from Facebook at login time and can login my app.
Any suggestions?

You are most likely getting an App Scoped ID, see App-scoped User IDs changelog: https://developers.facebook.com/docs/apps/changelog
It is not a temporary one, it will stay the same for every User in one App. It is just not the "real" one.
If you don´t get the friends (with /me/friends, i guess), it´s probably because you only get the friends who also use your App. This is also explained in the changelog:
App Friends: The /me/friends endpoint no longer includes the full list of a person's friends. Instead, it now returns the list of that
person's friends who are also using your app.

Related

Facebook friends list is empty, just for one specific user

Simply executing this query aiming to list all my friend's friends:
GET https://graph.facebook.com/hisFacebookUserId/friends?return_ssl_resources=1&access_token=hisAccessToken
I obtain an empty data entry. => as if it had 0 friends. (but he has 800).
However, it works for many other users.
What might be the reason?
Since v2.0 of the Facebook API, you can only get the friends who authorized your App too. It´s a (privacy) feature, not a bug.
https://developers.facebook.com/docs/apps/changelog
Also, it´s not necessary to use an ID for the call, because you can only get the friends of the authorized User anyway:
/me/friends
Btw, don´t forget to authorize Users with the user_friends permission.

Accessing Friends List on new FB APIs for non-app users

I am building an app where users can send picture messages to friends and would like users to see their Facebook friends list when they login through FB. However, I am confused by Facebook's new API information regarding the access that an app can have to display someone's list of friends. On the FB change log information page it says:
1) Friend list is no longer part of the default permission set and has its own permission: Asking for access to a person's friend list is now a separate permission that your app must request. The new permission is called user_friends.
2) Friend list now only returns friends who also use your app: The list of friends returned via the /me/friends endpoint is now limited to the list of friends that have authorized your app.
https://developers.facebook.com/docs/apps/changelog
Does this mean that my app will only display to users their Friends that are also using my app? Is there no way for a User to see their entire friends list? And if not, how can I prompt the User to invite new friends to use my app?
Thanks.
Yes, that is exactly what it means, and for what you want to do there is no way to get the friends who did not authorize your App. But maybe you want to use the Send Dialog instead: https://developers.facebook.com/docs/sharing/reference/send-dialog
For that, you don't even need to authorize the user and he can choose the receiver on his own.

Getting friend user id, and their photos

I am doing some research into the capacity of Facebook Connect. I have some questions on how a couple of bits of functionality.
Is it possible to fetch a list of all friends of a user?
The idea of this is that a user would log in using my site and then they could search through their friends and select one, and the site would get that friends users id and store it to the sites database.
Getting a photos from that user
After getting the friends user id, would it then be possible to get their photos? Or would the friend need to give the site permission to do that?
I am looking into a site where you can buy a greetings card for a friend, and i wanted to know whether my users would be able to login via facebook, pick a friend, get a photo and then at the time of their birthday it would send them a private message (which i think i know how to do) linking them back to my site where they could view the birthday card and their photo.
Thanks
To answer your questions:
Yes. Once you have an access token from the login process for a user, make a Graph API request to https://graph.facebook.com/me/friends. You can test this for yourself here: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends
Yes. During the login process, you must request user_photos and friends_photos permissions after which you can use the access token for a Graph API request to https://graph.facebook.com/USERID/photos. This will only return those photos for a friend which the user is allowed to see for the current privacy settings.

Can you lookup friends of friends with the Facebook graph API?

My app needs to generate a list of friends for the logged in user, as well as the friends of the friends. The logged in user has authorized the app. So I have no trouble getting their friends. When I make the /friends/ call to the API using one of the friends' IDs, I get this error message:
Can't lookup all friends of [FB ID]. Can only lookup for the logged in user or the logged in user's friends that are users of your app.
I knew that the public visibility of one's friends is a configurable setting for each individual user, but if I understand this message correctly it means that you simply cannot do what I'm trying... ever.
Question #1: Is this true? Is there simply no way to lookup someone's friends' friends?
Question #2: If it's not possible, how do sites like Glassdoor.com manage this exact functionality?
You cannot get the friends of friends of the person who is using the app.
Glassdoor.com sends invitations to the user's friends and when someone accepts, they simply get his friends since he becomes a user of their app.

Get a list of friends of a friend on Facebook

I've recently started looking into the Facebook API and am trying to work out how to retrieve the list of friends of another user (in this case the user is someone I'm friends with).
So far I've only worked out how to find out the friends of a person who I am also friends with. However the Friends Wheel application can do it as you can generate a wheel base on one of your friends, so I'm guessing it is possible.
Anyone know how to do this?
You Can only access friends list of logged in user(i.e, your friend list) or the logged in user's friends that are users of your app. i.e, You can access friends friend list only if your friends are the users of your app.
You can check if two of your friends are friends using friends.are_friends.
Once you've got a valid access token for a user, you can query the Graph API with said token and query the "friends" connection of the user object (/me/friends). So if your user ID is "123":
https://graph.facebook.com/123/friends?access_token=USERS_ACCESS_TOKEN
You can also use /me to reference the current user:
https://graph.facebook.com/me/friends?access_token=USERS_ACCESS_TOKEN
Without a valid access token, you cannot query information about users and access to friends of friends is determined by each user. For example, I cannot see some of my friend's friends:
Can't lookup all friends of (ID). Can only lookup for the logged in
user (ID), or friends of the logged in user with the appropriate
permission.
...but for some of my other friends, I can. There's probably a permission or flag you can check to see if they allow access, but I'm not currently seeing it.
I figured this out.
1) The best you can do is find mutual friends
2) Try using the v1.0 of the Facebook Graph API. v2.0 doesn't have /mutualfriends.
3) Since I was only interested in my own social network, I grabbed the access token from the graph explorer and wrote a python script to download my whole social network. The code is on github
Yes, its possible to get List of Friends of a friend but only condition is that friend should be user of that application.
Suppose there is an application "APP" used by "A" then the APP can get his friends List , now you want friends List of "B" who is friend of "A" , it will be possible only if "B" also uses the "APP"
Facebook are in the process of deprecating the REST API, and have added equivalent support to the Graph API for this method. You can use Graph API - User object and Get /User_id1/friends/User_id2 to check if User_id1 is friends with User_id2 .