FLITTERBOOK: INTEGRATING WITH THE FACEBOOK PLATFORM

I'm here at the Facebook Developer's event down here in San Francisco.  Dan'l Lewin from Microsoft was on stage as a parter:

Lots of good stuff announced as far as Facebook/Microsoft partnership: Microsoft just released a great wrapper to the Facebook API written by the guys at Clarity Consulting.  They've got some nice sample applications, including a cool WPF app that is a rolodex of your Facebook contacts.

Also, Popfly also added support for the Facebook API to their mashup builder.  Speaking of Silverlight, there's support for Silverlight in FBML via the FB:Silverlight tag, although it is undocumented right now and not quite there.  However, you can host Silverlight in an iframe using FBML.  More on that to come.

I implemented in an updated version of Flitterbook, which you can download here.  This version of Flitterbook now has support for the Facebook API and pulls all images from your friends along with Twitter feeds and Flickr data.  Again, this is still alpha code: no promises!

One thing I implemented in Flitterbook is support for infinite sessions with Facebook.  There aren't any code samples for this in the samples that ship with the Facebook  Developer Toolkit so I thought it might be useful for other folks. I save the Facebook infinite session data in a user config file using Visual Studio. The crux is that you have to pass your own secret if you don't have a secret that gets returned from Facebook to support an infinite session.  Here's the code:

//set infinite session parameters on to facebook data adapter
if (Settings.Default.IsFacebookInfiniteSession)
{
facebookConnect.UserId = Settings.Default.FACEBOOK_USERID;
facebookConnect.SessionKey = Settings.Default.FACEBOOK_SESSIONKEY;
//note here that we pass the secret that we saved
facebookConnect.Secret = Settings.Default.FACEBOOK_SECRET;
}
else
{
//if we don't have an infinite session, we use my application's secret
facebookConnect.Secret = secret;
//we invoke the UI dialog
facebookConnect.ConnectToFacebook();
//if the user let us save their session, throw it in config
if (!facebookConnect.SessionExpires)
{
Settings.Default.FACEBOOK_SESSIONKEY = facebookConnect.SessionKey;
Settings.Default.FACEBOOK_USERID = facebookConnect.UserId;
Settings.Default.FACEBOOK_SECRET = facebookConnect.Secret;
Settings.Default.IsFacebookInfiniteSession = true;
Settings.Default.Save();
}
}