I'm going more in depth in the Facebook javascript sdk but I am still new to it. I would like to display for every user on my website who logged with Facebook, their friends' pictures who also authorized the app. It is clearly and simply possible by using PHP SDK, but I only want to make use of javascript SDK to improve the speed of my site. Does anyone have an idea ?
Best,
Newben
You can use FQL to query the current user's friends SELECT id, name FROM user where uid IN (SELECT uid1 FROM friends WHERE uid2=me()) AND is_app_user=1. This query does two things. Finds all the friends and find only the friends who have your app installed.
For additional information see:
http://developers.facebook.com/docs/reference/fql/user/
and
http://developers.facebook.com/docs/reference/fql/friend/
Related
I am building a login system that depends on Facebook login plugin (https://developers.facebook.com/docs/facebook-login/web). Everything is going well with this easy to use plugin. The bad news is that: today, I noted that the Facebook changes its user IDs, and these changes can deceive your login system.
Explaining the process and the problem:
1- The user goes to your website and click Facebook login button to access to your website.
2- The plugin grabs the user's information from Facebook API, including the user Facebook ID.
3- Your script uses the grabbed info to check your database, looking for the Facebook ID in the users table.
4- If the Facebook ID exists, the system allows the user to login. If it does not exist, the system creates a new account for the user and login him/her to your website.
So, the same Facebook user might be registered more than one time as long as the Facebook changes the user's ID.
As I noted today: Sometimes, the Facebook gives its user an ID with 9 digits, and other times give the user an ID with 19 digits. If you used any of those IDs; it would redirect you to the same user's profile. For example: if the user's IDs are 999999999 and 1010101010101010101
https://facebook.com/999999999 and https://facebook.com/1010101010101010101 both URLs will lead you to same profile.
P.S. The script checks with the user's email, however the user has the choice not to supply his/her email address to your website.
I use API v2.. I didn't use the old version (v1.). So, I think this is not the issue of chronicle or app scoped IDs.
If you have any ideas that help in getting a fixed Facebook user ID, please let me know.
Thank you in advance
I am using passport.js to let users log in.
I am wondering if it's possible to create a link to their profile on their social media account?
For instance, when logging in using Facebook, I can get an ID, but the link https://www.facebook.com/profile.php?id=__ID__ doesn't work.
Maybe it's not possible at all since some Facebook users might have their Facebook profile hidden even though they use their account as login for other websites.
From what i know, this is not possible using passport at least.
The reason why the link doesn't work is that the ID returned by Facebook is always app specific so different apps would get different IDs for the same user. So you don't get the "official" ID of a user which you could use for building the URL.
However, the Facebook API returns a link to a users timeline which should be the one you are looking for (https://developers.facebook.com/docs/graph-api/reference/user/). But from what i see in the documentation of passport, this information is not returned. So if you want to get the link you need to work with the Facebook API directly.
I am trying to extract friends list of a profile. I tried looking for the help and only thing I got is, "/me/friends"
but this call has a limitation. This will only return any friends who have used (via Facebook Login) the app making the request.
I wanted to have the list of all the friends in my profile.
That´s how it works, you can´t get the full friendlist anymore. See the changelog for more information: https://developers.facebook.com/docs/apps/changelog
You can only get the friends who authorized your App too, for privacy reasons.
There are also plenty of other threads about that question already, for example:
Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app
Get ALL User Friends Using Facebook Graph API - Android
So I've been trying for this for a couple of days, trying to figure out how to use Facebook's Graph API v2.2 to get mutual friends between two users. I understand that I can only get the mutual friends between two users that are using the FB App and that's cool.
The app has the following approved items:
email
public_profile
user_birthday
user_friends
user_hometown
user_location
user_relationships
user_website
My scenario is this:
A user (user A) register to the FB App
Another user (user B) registers
User A looks at the user B's profile
The profile should display the mutual friends between the two users
I've tried to play around in the Graph API Explorer
/v2.2/app_scoped_user_id?fields=context.fields%28mutual_friends%29
and
/v2.2/user_id?fields=context.fields%28mutual_friends%29. These just returns an ID field with the ID I provided and nothing else.
I'm all out ideas, and the docs isn't helping much either. Can someone explain how to do it?
I will be using it in an Angular app but as long as I can get the URL to fetch the correct thing I can translate it into Javascript.
For v2.3 - https://developers.facebook.com/docs/graph-api/reference/v2.3/user.context/mutual_friends
Between friends make sure the user_id in the query is the Facebook id of the other friend not the current user whose access token you are using.
GET /v2.3/{other_user.user-id}?fields=context.fields%28mutual_friends%29
For querying mutual friends between two non-friends you need to add a server appsecret_proof parameter plus the user access token.
I'm working on web app which is NOT a Facebook Application.
I want to get current logged user's ID (I'm not sure if this is the right expression, I mean facebook.com/userid ) or user's name using Javascript.
Please if you don't know how to do it or if you don't have any suggestion what should help me, don't comment , thanks.How can I do this?
You cannot get the details (facebook id etc.) of the currently logged-in facebook user without using an app.
To query for the current user, you'll have to query for the /me and that requires an active access token which you can only get when the user authorizes an app!