How to set up social connection with Facebook
Adding social connection with Facebook to your app with Clerk is done in a few steps - you only need to set the Client ID, Client Secret and Authorized redirect URI in your instance settings.
To make the development flow as smooth as possible, Clerk uses preconfigured shared OAuth credentials and redirect URIs for development instances - no other configuration is needed.
For production instances, you will need to create your own developer account with Facebook and generate your own App ID and App Secret.
The purpose of this guide is to help you set up a Facebook developer account and a Facebook OAuth2.0 project - if you're looking for step-by-step instructions using Clerk to add Social Connection (OAuth) to your application, follow the Social connection (OAuth) guide.
Before you start
- You need to create a Clerk Application in your Clerk Dashboard. For more information, check out our Set up your application guide.
- You need to have a Facebook Developer account. To create one, consult the Register as a Facebook developer page.
Configuring Facebook social connection
First, you need to create a new Facebook app and enable Facebook Login. Follow the official Facebook instructions on how to create a Facebook app. When asked to choose an app type, make sure you select Consumer. To learn more about Facebook app types, check the Facebook App Types page.
At the end of the app creation wizard, you will get redirected to the app dashboard. Find the Facebook login card and click Set Up. There's no need to go through the quickstart wizard - open the Settings dropdown menu (sidebar) and click Basic, as shown in the screenshot above.
Once you have a OAuth client ID created, click on the newly created ID under OAuth 2.0 Client IDs and copy the App Id and App Secret.
Go to the Social Connections page in your Clerk Dashboard and enable Facebook. In the modal that opened, ensure Use custom credentials is enabled and paste the values you obtained during the previous step.
Before you close the modal, copy the Authorized redirect URI. Go back to the Facebook dashboard, open the Facebook Login menu (sidebar) and click Settings. Paste the URI you copied before into the Valid OAuth Redirect URIs field. Hit Save Changes.
Don't forget to click Apply in the Clerk dashboard. Congratulations! Social connection with Facebook is now configured for your instance.