tags:

views:

100

answers:

1

How do I display a list of my friends' Facebook statuses on my own web site using Facebook Connect?

Essentially, I want to log into my own web site on my own domain using Facebook Connect's login mechanism, and then display a Feed-like status alongside my own web site's content (so long as I'm logged in via Facebook Connect). I haven't been able to find any tutorials that do this—they're mostly concerned with other people logging onto my web site via Facebook Connect to post comments and things, which is not what I'm after.

If I could use the Facebook REST API instead of Facebook Connect to retrieve this data, that would be even better.

+1  A: 

The JavaScript client library that Facebook Connect uses lets you do almost everything from JS that Facebook apps can do from inside the site.

To retrieve a list of the user's friends in JavaScript, make sure the user has connected and then call FB.Facebook.apiClient.friends_get, passing in a function to call when the data is retrieved. You can get your own or a friend's current status with the Users.getInfo API call. Something like the following should get you going:

FB.Facebook.apiClient.friends_get(null,function(data){
  var statusData = FB.Facebook.apiClient.users_getInfo(data,['uid','status']));
  //Do something with statusData return objects here
}

Make sure that you've included the correct libraries with a FB_RequireFeatures(["Api"],function(){//callback here}) call.

You can also use Connect authentication with server-side client libraries and make the same API calls.

Karl B

related questions