Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

 1 Answer(s)

  • Priyanka, Facebook has its own SDK which allow user to login & signup via facebook

    Refrence URL:

    or you can use below code to integrate facebook login

    1. Paste JavaScript code in header or footer:

    The below code is a JavaScript code; this function will call when user click on login fb button.

    <script type="text/javascript">
    window.fbAsyncInit = function()
            appId: 'set&#95;fb&#95;app&#95;Id', // App ID
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true, // parse XFBML
            oauth: true 
    function loginViaFacebook()
            if (response.authResponse)
                // connected
                window.location.href = ''; // set your redirect url after login
                // User cancelled login or did not fully authorize
            scope: 'email,public&#95;profile'
    (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +

    note: please replace &#95; with "_" while copying the above code.

    1. Use below html code to render facebook login button.
    2. < input type="button" value="Sign in with Facebook" onclick="javascript:loginViaFacebook();" /> < div id="fb-root">
    3. Please extract attached file & call it like this:- require_once('set_absolute_path/fb/src/facebook') then, use below PHP code to get user details after authentication from Facebook.
    4. // Set facebook app credential
              $facebook = new Facebook(array(
                  'appId'  => 'set_fb_app_Id',
                  'secret' => 'set_fb_secret'
              // Get User ID
              $user = $facebook->getUser();
              if ($user)
                      // Proceed knowing you have a logged in user who's authenticated.
                      $user_profile = $facebook->api('/me');
                      // Get profile image
                      $profile_image = $facebook->api('me/picture', array('redirect'=>false, 'height'=>'125', 'type'=>'normal', 'width'=>'125'));
                      // Process your logic here
                  catch (FacebookApiException $e)
                      $user = null;
Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: