Skip to content

Last updated

To set up Facebook login, create a Meta app with the Facebook Login use case, then enter its App ID and App Secret in TML Social.

Before You Start

Until you publish the app, only people with a role on it (you, and anyone you add under "App roles") can log in with Facebook. Everyone else gets an error from Facebook. Publishing requires a privacy policy, terms of service and instructions for deleting user data, each at its own URL, so have those pages ready.

Create the App

Follow Meta's Create an App guide. When asked for a use case, choose "Authenticate and request data from users with Facebook Login". A business portfolio isn't needed.

Set Up Facebook Login

  1. In the app's dashboard, click "Use cases" in the left menu, then "Customize" next to the Facebook Login use case.
  2. Under "Permissions", add "email" and click "Increase access" for "public_profile". Neither needs App Review.
  3. Under "Settings", add your TML login page URL with the provider appended as a query argument to "Valid OAuth Redirect URIs". By default, this is https://yoursite.com/login/?provider=facebook. If you changed the login page slug, use yours instead of "login". If your site uses plain permalinks, it's https://yoursite.com/?action=login&provider=facebook. Facebook requires an exact match, including the query string, and HTTPS.

On a multisite network, each site has its own login page, so add a redirect URI for every site that shows the buttons.

Obtain App ID & App Secret

In the app's dashboard, go to App Settings → Basic. Copy the App ID and the App Secret into their corresponding fields under Theme My Login → Social. On a multisite network, the settings are in the Network Admin, and one Facebook app serves every site on the network.

Click "Facebook" to open its box if it's closed, check "Enable" and then click "Save Changes".

Publish the App

On the same App Settings → Basic page, fill in the fields Meta requires to go live, including the app icon, category, privacy policy URL, terms of service URL and user data deletion URL. Then go to Publish → Go live and click "Go live". See Meta's Release Your App guide.

Login With Facebook

You will now see "Continue with Facebook" on your login form. The first time someone logs in, they're matched to an existing user with the same email address or, if registration is open, a new user is created for them.

Facebook doesn't return an email address for every account. Those users see "An email address is required to log in to this site" and need to use another way to log in.