> ## 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.

# Google

> Configure Google OAuth for your Auth application.

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

## Prerequisites

* A [Google Cloud project](https://console.cloud.google.com/)
* Your Google OAuth **Client ID** and **Client Secret**

## Configure Google OAuth

<Steps>
  <Step title="Create OAuth credentials on Google Cloud">
    1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
    2. Select your project (or create a new one)
    3. Navigate to **APIs & Services > Credentials**
    4. Click **Create Credentials > OAuth client ID**
    5. Select **Web application** as the application type
    6. Give it a name (e.g. "Prelude Auth")
    7. Copy the **Client ID** and **Client Secret** — you will need them in the next step
  </Step>

  <Step title="Set the authorized redirect URI">
    Still on the same OAuth client page in the Google Cloud Console:

    1. Under **Authorized redirect URIs**, click **Add URI**
    2. Enter the following URI:

    ```
    https://${YOUR_CUSTOM_DOMAIN}/v1/session/login/oauth/google/callback
    ```

    Replace `${YOUR_CUSTOM_DOMAIN}` with your [custom domain](/session/documentation/domain-names) (e.g. `session.yourapp.com`).

    3. Click **Save**

    <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 Google OAuth configuration">
    ```bash theme={null}
    curl -X POST https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/google \
      -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
      -H "Content-Type: application/json" \
      -d '{
        "client_id": "your-google-client-id",
        "client_secret": "your-google-client-secret",
        "enabled": true,
        "options": {
          "use_email_as_identifier": true,
          "allow_email_account_merge": true
        }
      }'
    ```

    | Field                               | Description                                                                                                   |
    | ----------------------------------- | ------------------------------------------------------------------------------------------------------------- |
    | `client_id`                         | Your Google OAuth client ID.                                                                                  |
    | `client_secret`                     | Your Google OAuth client secret.                                                                              |
    | `enabled`                           | Set to `true` to enable Google login.                                                                         |
    | `options.use_email_as_identifier`   | When `true`, the user's Google email is stored as an email identifier.                                        |
    | `options.allow_email_account_merge` | When `true`, if a user with the same email already exists, the Google account is linked to the existing user. |
  </Step>
</Steps>

## Update the configuration

To update an existing Google OAuth configuration:

```bash theme={null}
curl -X PUT https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/google \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "your-new-google-client-id",
    "client_secret": "your-new-google-client-secret",
    "enabled": true,
    "options": {
      "use_email_as_identifier": true,
      "allow_email_account_merge": true
    }
  }'
```

## Delete the configuration

To remove Google OAuth from your application:

```bash theme={null}
curl -X DELETE https://api.prelude.dev/v2/session/apps/${APP_ID}/config/login/oauth/google \
  -H "Authorization: Bearer ${MANAGEMENT_API_KEY}"
```

## What's next?

Now that Google OAuth is configured on your backend, integrate the frontend using the [Web Integration](/session/documentation/frontend-sdks/web/social-login) guide.
