> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prelude.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Facebook

> Configure Facebook OAuth for your Session application.

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

## Prerequisites

* A [Meta for Developers](https://developers.facebook.com/) account
* Your Facebook **App ID** (client ID) and **App Secret** (client secret)

## Configure Facebook OAuth

<Steps>
  <Step title="Create a Facebook app">
    1. Go to [Meta for Developers](https://developers.facebook.com/apps/)
    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
  </Step>

  <Step title="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](/session/documentation/domain-names) (e.g. `session.yourapp.com`).

    3. Click **Save changes**

    <Note>
      The redirect URI must match exactly. Make sure there is no trailing slash and that you are using `https`.
    </Note>
  </Step>

  <Step title="Create the Facebook OAuth configuration">
    ```bash theme={null}
    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
        }
      }'
    ```

    | Field                               | Description                                                                                                     |
    | ----------------------------------- | --------------------------------------------------------------------------------------------------------------- |
    | `client_id`                         | Your Facebook App ID.                                                                                           |
    | `client_secret`                     | Your Facebook App Secret.                                                                                       |
    | `enabled`                           | Set to `true` to enable Facebook login.                                                                         |
    | `options.use_email_as_identifier`   | When `true`, the user's Facebook email is stored as an email identifier.                                        |
    | `options.allow_email_account_merge` | When `true`, if a user with the same email already exists, the Facebook account is linked to the existing user. |

    <Note>
      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.
    </Note>
  </Step>
</Steps>

## Update the configuration

To update an existing Facebook OAuth configuration:

```bash theme={null}
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:

```bash theme={null}
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](/session/documentation/frontend-sdks/web/social-login) guide.
