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();


Auto-click function for google sign button using javascript


  

Auto-click function for  google sign button using javascript

(Function to initialize google sign process)

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

Now i want to click on some other button and want to initialize google sign functionality .

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

var myParams = {
    'clientid': 'your client-id',
    'cookiepolicy': 'single_host_origin',
    'callback': 'onSignInCallback',
    'scope': 'email'
};
gapi.auth.signIn(myParams);