.

Monday, June 28, 2010

Facebook enables you to remove the registration process for your site by enabling users to log in to your site with their Facebook account

The Facebook Platform uses the OAuth 2.0 protocol for authorization. You can find all the details for Facebook's implementation of OAuth 2.0 in the authentication guide.
While you can implement a complete login and signup system using OAuth 2.0 directly, the open source JavaScript SDK is a simple way to implement login and signup without worrying about the details of the protocol. When a user logs into your site, the SDK saves the credentials for the active Facebook user in a cookie on your site's domain so that you can use the user's identity easily in both your server-side and JavaScript code. It provides a single, simple callback so your application can automatically handle the complex set of authentication states that exist in a single-sign on system.
For example, if a user has previously logged into your website, but doesn't have a cookie for your site in the current browser, the SDK will automatically detect that condition and instantly log the user in to your site without requiring the user to click a Facebook login button again.
The JavaScript SDK requires that you register your application with Facebook to get an app id for your site. In general, you should use only one Application ID for your base domain; a single Application ID allows you to create a full-featured application. Once you have your app id, add this to the bottom of your page:

The auth.sessionChange callback is called every time a user logs in or out of your site. It is automatically called, e.g., when the user is logged into Facebook and has previously logged into your site, but is missing a cookie for your site in the current browser.
With the API initialized, you can pop up a Facebook authorization dialog by calling the FB.login JavaScript method, or you can include the standard Facebook login button with the  tag:

which renders the standard Facebook login button:
Authentication dialog
If u wanna see the details...

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Macys Printable Coupons