Friday, 21 October 2011

How create facebook login

1. Go https://developers.facebook.com/apps and click create new App

2. After create your App, you get App ID/API Key and App Secret code.



3. Enter your website name to include Facebook login


4.Add following code in your login page
<html>
    <head>
      <title>My Facebook Login Page</title>
    </head>
    <body>
      <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            appId      : 'YOUR_APP_ID',
            status     : true, 
            cookie     : true,
            xfbml      : true
          });
        };
        (function(d){
           var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/en_US/all.js";
           d.getElementsByTagName('head')[0].appendChild(js);
         }(document));
      </script>
      <div class="fb-login-button" data-perms="email,user_checkins">
        Login with Facebook
      </div>
    </body>
 </html>

5.For more https://developers.facebook.com/docs/guides/web/

0 comments:

Post a Comment