-1

I am using facebook javascript login sdk for a normal app. I have written a script for this. But i want to replace facebook login button with one of my custom image.

Upendra Sharma
  • 575
  • 2
  • 9
  • 28

1 Answers1

2

You can use your own login button by using FB.login of the JavaScript SDK.

HTML:

<button id="loginBtn">Facebook Login</button>

JavaScript:

document.getElementById('loginBtn').addEventListener('click', function() {
    //do the login
    FB.login(function(response) {
        if (response.authResponse) {
            //user just authorized your app
            document.getElementById('loginBtn').style.display = 'none';
            getUserData();
        }
    }, {scope: 'email,public_profile', return_scopes: true});
}, false);

More information: http://www.devils-heaven.com/facebook-javascript-sdk-login/

andyrandy
  • 72,880
  • 8
  • 113
  • 130