Use Facebook Connect to Bring Your Application to Millions of Users
If you're trying to promote your hot new web application, you cannot ignore the millions of users of social networking sites (including Facebook, MySpace, and LinkedIn). You can allow them to use your application without registering (removing one of the most significant hurdles), post application updates to their newsfeeds, and even invite their friends to start using your application.
In this article, we'll focus on the easiest task: using Facebook as a single sign-on server. Our application (simply called Login.htm) will authenticate a user by using her Facebook account, allowing us to identify users uniquely[md]without their ever having to fill in a registration form.
Facebook Integration Options
To integrate your application with Facebook, you can choose from three fundamental options:
- The application runs within the Facebook canvas. The numerous Facebook quizzes covering everything you ever wanted to know (including your Klingon name) use this option.
- Your web server communicates with Facebook through the Facebook REST API.
- The integration is done in the user's browser through the Facebook Connect API.
Facebook Connect is the easiest and least-intrusive integration method, because it allows you to get the benefits of Facebook integration simply by including a few lines of JavaScript code in select application pages.
The integration between the Facebook user accounts and your authentication databases depends on whether you're integrating an existing application or a completely new one.
If a new application requires an easy registration/authentication method, it's best to rely on Facebook authentication and allow Facebook users to access your application without further administrative burden. Obviously, you still have to give visitors an option to register on your site and use your application without using Facebook.
Existing applications can opt for tight Facebook integration (in which a Facebook account can serve as a single sign-on mechanism) or a very loose integration (in which a user you've already authenticated can decide to connect to Facebook on an as-needed basis). This is the approach I took in my application.