Header menu

_________________________________________________________________________________

Tuesday, 30 September 2014

Auto-click function for facebook login button using javascript


  

Auto-click function for  facebook login button using javascript

(Function to initialize facebook login process)


I have added facebook sign button on my website. On clicking on it i can make user to login in my application using facebook account.

Now i want to click on some other button and want to initialize facebook login functionality .

To do so i need 2-3 lines of code / a function to start login process.

function facebookLogin() {
    FB.login(function(response) {
        if (response.authResponse) {
        statusChangeCallback(response);
        //    console.log('Authenticated!');
            // location.reload(); //or do whatever you want
        } 
    },
    {
        scope: 'email,user_checkins'
    });
}
facebookLogin();