Login Button

The Login Button is a simple way to trigger the Facebook Login process on your website or web app.

If someone hasn't logged into your app yet, they'll see this button, and clicking it will popup a Login dialog, starting the login flow. People who have already logged in won't see any button, or you can also choose to show a logout button to them.

The Login Button is only designed to work in connection with the JavaScript SDK - if you're building a mobile app or can't use our JavaScript SDK, you should follow the login flow guide for that type of app instead.

Plugin Configurator

Maximum Rows of Photos
Button Size


In addition to the settings above, you can also change the following:

Setting HTML5 Attribute Description Options



If enabled, the button will change to a logout button when the user is logged in.

false, true



The maximum number of rows of profile photos in the Facepile when show_faces is enabled. The actual number of rows shown may be shorter if there aren't enough faces to fill the number you specify.




A JavaScript function to trigger when the login process is complete.




The list of permissions to request during login.

basic_info (default) or a comma separated list of permissions



Picks one of the size options for the button.

small, medium, large, xlarge



Determines whether a Facepile of logged-in friends is shown below the button. When this is enabled, a logged-in user will only see the Facepile, and no login or logout button.

false, true



Determines what audience will be selected by default, when requesting write permissions.

everyone, friends, only_me


How do I use this to log users in?

Once someone has clicked the Login Button, and accepted the Login Dialog - completing the Login flow - your app can now use the Facebook SDK for JavaScript to make API calls on behalf of that person.

There is no extra set up required here, however you can use the onlogin setting in the button to trigger your own JavaScript function that will run upon login.

Can I use the Login Button with server-side registration code?

You can, however you will still need to use the JavaScript SDK partially. Once the login process started by clicking on the button is done, the SDK will have access to an authResponse object using FB.getLoginStatus(). You can use this function to pass the response object to your server-side code to complete any registration that exists there.

Can I use the Login Button to re-request a permission that a person has declined?

The Login Button doesn't support re-requests because asking for declined permissions doesn't fit the verb on the button. If you need to re-request a permission, set up a custom button and use FB.login() as described in the Facebook Login for the Web documentation.