my6solutions

asp .net, the social web & other distractions

 

Running Apps


PayPal - The safer, easier way to pay online!

Disclaimer

I am in no way affiliated with Microsoft or Google. I am just another developer trying to make a difference. All opinions and observations are usually my own.

How Facebook Connect's Friend Linking Works

One of the cool features of Facebook Connect is friend linking. Basically, as the owner of a site you are able to inform your FB connected site users of their other FB friends that are also using the site. This will allow them to quickly find friends in your site.

Programmatically, how this is achieved is as follows

Note: "You" here refers to you the external site owner

  • When a user registers on your site normally ,i.e. they provide their email address, and you register a hash of this email address using connect.registerUsers. However, this email address must also be the one that they use on facebook, otherwise facebook will not be to recognise the user.
  • The alternative method is when a user uses your site without registering but instead uses it via Facebook Connect. In this situation, their email will be unknown to you.
  • If the user then uses "Facebook Connect" to connect with Facebook, you now have their Facebook ID.
  • With a Facebook ID, you will be able to 
    • obtain the number of their friends using the site but have yet to link up (i.e. you do not have their Facebook ID but have their email address) using connect.getUnconnectedFriendsCount. You can then prompt the user to invite their unconnected friends to connect with your site using connect.InviteConnectUsers.

    • obtain a list of of their friends using your site via friends.getAppUsers. For this to work, these friends must also have connected with your site. These friends are what is defined as "connected friends". You can then suggest these friends to the user to connect with locally on your site.
And that should be it on the friend linking bit of Facebook Connect.

 

Bookmark and Share

Tags:
Categories: ASP .NET | facebook
Permalink | Comments (2) | Post RSSRSS comment feed

Comments

petegreg

Thursday, September 10, 2009 11:49 AM

petegreg

I've never worked with c# before so this might be a real newbie question but you seem to be doing some of the same things I'm attempting.
I'm using the Facebook .NET API Client with MVC to build a facebook Iframe application to connect to my existing swimming results calculation site www.oceanswimseries.com thats been ticking over for a few years and has about 1000 registered swimmers. The registration is not about access controll it just lets me match their name to swim results and put them in an age category based on their year of birth.

I want to be able to put a connected users's friends into 1 of three possible groups based on their interaction with my facebook app and my site and from there prompt the user to invite them to connect.
1) the friend is also connected to my facebook app and is therefor also registered on the site.
2) the friend is not connected but has previously registered on the site
3) the friend is not connected, is not registered on the site but does seem to have (based only on name and surname match) some swim results in the master results table.

I've got that all working fine using the following code where I've manuall added a few facebook ids into 'uids' my problem is getting that list of facebook uids into that string using FacebookResponse<List<Int64>> friends = FbContext.Friends.Get(FbSession.Uid);

Like I say i'm new to c# and its probably just a simple thing but any help would be great.

var uids = new String[] { "54xxxxx","69xxxx", "6719xxxx", "xxx7231" };
            var fields = new String[] { "first_name", "last_name" };
            String[] fbfriendNames = new String[fbfriendsCount];

            var getInfoResponse = this.FbContext.Users.GetInfo(uids, fields);
            var GetInfo = getInfoResponse.Value;
            
            int i = 0;
          
            foreach (var friend in GetInfo) // Loop through friends
            {
               // check if they're connected

                    // else are they registered

                         // else do they have some results

уеб дизайн

Monday, September 28, 2009 9:45 PM

уеб дизайн

Hi man,
Can you tell me how to add Facebook connect into my facebook?