Facebook Connect w/ Facebooker

Facebook Connect seems to be well on its way to becoming the most popular third party authenticator on the market. While Facebooker provides support for Facebook Connect, the Connect features are given only a light treatment in a blog entry by Mike Mangino (one of Facebooker’s authors). In this article, I will attempt to fill in some of the blanks left by that entry.

After following Mike’s example, I put _fb_logout_link in my template, clicked on it, but found that my web app was still convinced that I was logged into Facebook. That is, I still had the facebook_session object in my webap. Mike’s article show’s how to handle logging in to Facebook Connect; however, logging out was causing me frustration.

The below seemed to work for me:

In your ERB (for example), you will want:

<%= fb_logout_link "Logout", "/logout" %>

fb_logout_link will log you out of Facebook; however, it does not seem to nil out the the facebook_session object referred to in Mike’s example. As such, you’ll want to map “/logout” to an action that will do this for you. The logout operation should look something like:

def logout
  # ...
  clear_facebook_session_information
  # your redirect here    
end

clear_facebook_session_information is a method in the Facebooker::Rails::Controller module that will do exactly as the name says

Posted by evan on Tuesday, November 03, 2009

blog comments powered by Disqus