Skip to main content
This guide walks you through configuring Facebook as a social login provider for your application.

Prerequisites

  • A Meta for Developers account
  • Your Facebook App ID (client ID) and App Secret (client secret)

Configure Facebook OAuth

1

Create a Facebook app

  1. Go to Meta for Developers
  2. Click Create App
  3. Select a use case that includes Facebook Login (for example, “Authenticate and request data from users with Facebook Login”)
  4. Fill in the app details and finish the creation flow
  5. In the app dashboard, add the Facebook Login product if it is not already added
  6. Navigate to App settings > Basic to find your App ID and App Secret — you will need them in the next step
2

Set the authorized redirect URI

In your Facebook app dashboard:
  1. Go to Facebook Login > Settings
  2. Under Valid OAuth Redirect URIs, add:
https://${YOUR_CUSTOM_DOMAIN}/v1/session/login/oauth/facebook/callback
Replace ${YOUR_CUSTOM_DOMAIN} with your custom domain (e.g. session.yourapp.com).
  1. Click Save changes
The redirect URI must match exactly. Make sure there is no trailing slash and that you are using https.
3

Create the Facebook OAuth configuration

curl -X POST https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/facebook \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your-facebook-app-id",
    "client_secret": "your-facebook-app-secret",
    "enabled": true,
    "options": {
      "use_email_as_identifier": true,
      "allow_email_account_merge": true
    }
  }'
FieldDescription
client_idYour Facebook App ID.
client_secretYour Facebook App Secret.
enabledSet to true to enable Facebook login.
options.use_email_as_identifierWhen true, the user’s Facebook email is stored as an email identifier.
options.allow_email_account_mergeWhen true, if a user with the same email already exists, the Facebook account is linked to the existing user.
Facebook only returns an email when the user grants the email permission and their Facebook account has a verified email address. Users without a verified email on Facebook will sign in without an email identifier.

Update the configuration

To update an existing Facebook OAuth configuration:
curl -X PUT https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/facebook \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your-new-facebook-app-id",
    "client_secret": "your-new-facebook-app-secret",
    "enabled": true,
    "options": {
      "use_email_as_identifier": true,
      "allow_email_account_merge": true
    }
  }'

Delete the configuration

To remove Facebook OAuth from your application:
curl -X DELETE https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/facebook \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}"

What’s next?

Now that Facebook OAuth is configured on your backend, integrate the frontend using the Web Integration guide.