Facebook API

Step1: By using facebook account go to facebook developers platform.
Click Setup New Application

Step2: Assign your application name and agree the terms and condtion described by facebook.

Step3: In Facebook Integration Tab, 
Choose Canvas page
http://apps.facebook.com/[FOLDER NAME].
Canvas URL: Server Address
Canvas Type: IFRAME or FBML(Facebook Markup Language).

Step4: Integrate App on Profile Tab.
Tab Name: Desired Name
Tab URL: URL of the Application

API Using in Webpage:
First thing need to initialize, that interact with Facebook Apps.

<script type="text/javascript">
      FB.init({
            appId  : 'APP ID GENERATE BY FACEBOOK',
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true  // parse XFBML
       });

Implement Facebook Inbuilt Login Button:
<fb:login-button show-faces="false" id="login"></fb:login-button>

Implement Customize Login Button: Fire Javascript Onclick event
FB.login(function(response)
            {
                if (response.session)
                {
                    if (response.perms)
                    {   
                        // user is logged in and granted some permissions.
                        // perms is a comma separated list of granted permissions
                    }
                    else
                    {
                        // user is logged in, but did not grant any permissions
                    }
                }
                else
                {
                    // user is not logged in
                }
            });

Checking User Session:
function handleSessionResponse(response) 
{
    if (response.session) 
    {
        // USER LOGIN
    }
}


External Links:
Facebook Javascript Graph API Docs:
Comments