Silverlight/Facebook Connect - Determine Connect Status

Oct 22, 2009 at 10:55 PM
Edited Oct 22, 2009 at 11:00 PM

I'm a newbie to Facebook development, and I'm trying to build a Facebook Connect app in Silverlight.  I've got the basic scenario working: a user clicks a "Connect to Facebook" button, the Facebook login screen is displayed, and then my app retrieves the list of the user's friends.  So far so good.  But the way it works now, the user needs to re-authenticate with FB every time, and from what I've seen on other sites, I don't think that should be required.  So I'm trying to figure out how to get around displaying the authentication dialog box every time.  But I haven't been able to find quite the right combination of explanation/code samples to get me going.  Any suggestions on where to look to find a good example on how to store a user's credentials/session/whatever, and only display the "Connect with Facebook" dialog box the first time the user wants to make the connection?  Is there something blindingly obvious to everyone else that I'm just somehow not seeing?

On a side note, I think that there's a bug of some sort in the fblogin.js file that's in the various Silverlight samples.  The isUserConnected() method looks like this:

function isUserConnected() {
    FB.ensureInit(function() {
        FB.Connect.get_status().waitUntilReady(function(status) {
            var plugin = document.getElementById(silverlightPluginId);
        });
    });
}

I think it's missing one line:
function isUserConnected() {
    FB.ensureInit(function() {
        FB.Connect.get_status().waitUntilReady(function(status) {
            var plugin = document.getElementById(silverlightPluginId);
            plugin.Content.FacebookLoginControl.GetStatus(status);
        });
    });
}
Does that seem right to anyone else?
I should add that I'm using the pre-release (but apparently otherwise stable) 3.0 version of the FB Dev Toolkit.