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

# Google OAuth

> Google OAuth authentication setup

Configure Onyx to use Google OAuth for user authentication,
providing a seamless login experience through existing Google accounts.

Google providers are managed at **Admin Panel** → **Organization** → [SSO
Providers](/deployment/authentication/sso_providers). No environment variables or restarts are needed,
and you can configure multiple providers (enabling more than one at the same time requires the Business plan,
see [Plan Availability](/deployment/authentication/sso_providers#plan-availability)).

**Prerequisites:**

* [Google Cloud Console](https://console.cloud.google.com/) access
* Administrative permissions to configure OAuth applications

## Guide

<Steps>
  <Step title="Create Google Cloud Project">
    Navigate to the Google Cloud Console [Project Creation page](https://console.cloud.google.com/projectcreate)
    and fill in the required fields.

    <img className="rounded-image" src="https://mintcdn.com/danswer/bNCAyv_0mlX0VYMw/assets/deployment/gcc_project_creation.png?fit=max&auto=format&n=bNCAyv_0mlX0VYMw&q=85&s=92a54e8c020fabbbfb25951ac3b264d3" alt="Google Cloud Console Project Creation Page" width="1094" height="960" data-path="assets/deployment/gcc_project_creation.png" />
  </Step>

  <Step title="Enable Google People API">
    Navigate to **APIs & Services** and find [Google People
    API](https://console.cloud.google.com/apis/library/people.googleapis.com).

    Ensure your newly created project is selected in the top bar and click **Enable**.

    <img className="rounded-image" src="https://mintcdn.com/danswer/bNCAyv_0mlX0VYMw/assets/deployment/gcc_people_api.png?fit=max&auto=format&n=bNCAyv_0mlX0VYMw&q=85&s=09ae6e47291b23d8a0ede936922e3daa" alt="Google Cloud Console People API Enable Page" width="1246" height="628" data-path="assets/deployment/gcc_people_api.png" />
  </Step>

  <Step title="Create Google Auth Platform">
    Open the left sidebar and navigate to **APIs & Services** → **OAuth Consent Screen**.

    Once on the **Overview** page, click **Get Started**.

    <img className="rounded-image" src="https://mintcdn.com/danswer/bNCAyv_0mlX0VYMw/assets/deployment/gcc_oauth_consent.png?fit=max&auto=format&n=bNCAyv_0mlX0VYMw&q=85&s=2f65cf5fb72e56845b8df48c62391d64" alt="Google Cloud Console OAuth Consent Screen Page" width="1470" height="892" data-path="assets/deployment/gcc_oauth_consent.png" />
  </Step>

  <Step title="Configure OAuth Project & Consent Screen">
    Fill in the **App name** and **User support email** fields.

    Select your **Audience**. If you have a Google Workspace organization, select **Internal**. If not,
    select **External**.

    <Note>
      If you select **External**, you will need to add your users manually in the **Audience** tab under **Test users**.
    </Note>

    Fill in any other required fields and finalize the configuration.
  </Step>

  <Step title="Create OAuth Client">
    Navigate to **APIs & Services** → **OAuth Consent Screen** → **Clients** page.

    Click **"+ Create Client"** and select **Web Application**.

    <img className="rounded-image" src="https://mintcdn.com/danswer/bNCAyv_0mlX0VYMw/assets/deployment/gcc_oauth_client.png?fit=max&auto=format&n=bNCAyv_0mlX0VYMw&q=85&s=1e363d54b1180ae8b60168667041ca24" alt="Google Cloud Console OAuth Client Creation Page" width="1918" height="600" data-path="assets/deployment/gcc_oauth_client.png" />
  </Step>

  <Step title="Configure OAuth Client">
    **Name:** `Onyx`

    Add your Onyx origin under **Authorized JavaScript origins**,
    and add an **Authorized redirect URI** using the name you will give the provider in Onyx (a lowercase slug, e.g.
    `google`):

    If hosting Onyx locally use:

    ```
    http://localhost:3000
    http://localhost:3000/api/auth/oidc/YOUR_PROVIDER_NAME/callback
    ```

    If hosting Onyx on a custom domain use:

    ```
    https://YOUR_ONYX_DOMAIN.com
    https://YOUR_ONYX_DOMAIN.com/api/auth/oidc/YOUR_PROVIDER_NAME/callback
    ```

    <img className="rounded-image" src="https://mintcdn.com/danswer/bNCAyv_0mlX0VYMw/assets/deployment/gcc_oauth_client_details.png?fit=max&auto=format&n=bNCAyv_0mlX0VYMw&q=85&s=ddb8e60257f6b624bc463ae49e356a7a" alt="Google Cloud Console OAuth Client Creation Page" width="1918" height="1966" data-path="assets/deployment/gcc_oauth_client_details.png" />

    <Tip>
      Make sure the URIs you enter here match the URI you use to access Onyx!
    </Tip>
  </Step>

  <Step title="Save OAuth Credentials">
    Click **Create** → **Download JSON** to save the OAuth client credentials. Alternatively,
    save the **Client ID** and **Client Secret** to a password or secrets manager.
  </Step>

  <Step title="Add the Provider in Onyx">
    Navigate to **Admin Panel** → **Organization** → [SSO Providers](/deployment/authentication/sso_providers)
    and click **Add Provider**.

    Select the **Google** provider type, enter the **Name** you used in the redirect URI,
    and paste the **Client ID** and **Client Secret**.

    After creating the provider, its row shows the exact **Redirect URI**.
    Confirm it matches what you registered on the OAuth client, then sign in through the new option on the login page.
  </Step>
</Steps>

## Customizing requested scopes

By default, Onyx requests `openid`, `email`,
and `profile` from Google during login — the minimum needed to identify the user.
Overriding the list is primarily useful when the access token issued at login should be passed through to tool calls
that need additional Google API access.

Starting in `v4.5`, set **Scopes** on the provider entry (**Admin Panel** → **Organization** → **SSO Providers**)
to override the list per provider. A provider's **Scopes** take precedence. When left empty,
the deployment-wide environment variable applies, then the built-in defaults.

On `v4.4.x`, the only override is the deployment-wide `GOOGLE_OAUTH_SCOPE_OVERRIDE` environment variable,
a comma-separated list:

```bash .env theme={null}
GOOGLE_OAUTH_SCOPE_OVERRIDE=openid,email,profile,https://www.googleapis.com/auth/drive.readonly
```

<Warning>
  The override **replaces** the default scopes — make sure `openid`, `email`,
  and `profile` are still included if you want standard login to keep working.
</Warning>

<Note>
  Any scopes you add here must also be enabled on the OAuth client in Google Cloud Console (consent screen + client
  configuration). Onyx only changes what is sent in the authorize request;
  Google still rejects scopes that are not configured for the client.
</Note>

<Note>
  These scopes apply only to the **app login** and pass-through OAuth flows.
  The Google Drive and Gmail **connectors** use their own scopes and OAuth flow, which are not affected by this setting.
</Note>

## Enabling PKCE

PKCE is disabled by default.

Starting in `v4.5`,
turn on **Enable PKCE** on the provider entry (**Admin Panel** → **Organization** → **SSO Providers**).

On `v4.4.x`, the deployment-wide `OIDC_PKCE_ENABLED` environment variable enables it for all providers.
Google login shares the OIDC login route, so the OIDC-named variable applies here too:

```bash .env theme={null}
OIDC_PKCE_ENABLED=true
```

<Warning>
  `OIDC_PKCE_ENABLED=true` forces PKCE on for every provider, including providers whose **Enable PKCE** toggle is off.
  Unset it if you want the per-provider toggles to be the source of truth.
</Warning>

## Upgrading from v4.3 or Earlier

Versions before `v4.4.0` configured a single Google provider through environment variables,
using the redirect URI `https://YOUR_ONYX_DOMAIN.com/auth/oauth/callback` on the OAuth client.
On `v4.4.0` and later these variables no longer enable Google login, and they are planned for full removal in `v4.5`.
New installs must use the admin panel flow above.

<Note>
  When you upgrade an existing deployment,
  its environment-based configuration is imported into an SSO provider entry automatically,
  and existing logins keep working. The import runs once, when the upgrade first runs against your existing database,
  so keep the configuration in place through the upgrade.
  The migrated provider keeps using the redirect URI already registered in the Google Cloud Console,
  so nothing changes on the Google side. Once the migrated provider appears in the admin panel,
  sign-ins and token refresh use the provider entry's credentials, and `AUTH_TYPE`, `OAUTH_CLIENT_ID`,
  and `OAUTH_CLIENT_SECRET` can be removed.
  The variables only act as a fallback for login accounts that no provider entry matches,
  such as after deleting or renaming the migrated provider.
</Note>

For reference, a pre-`v4.4.0` configuration looks like:

```bash .env theme={null}
AUTH_TYPE=google_oauth
OAUTH_CLIENT_ID=YOUR_CLIENT_ID
OAUTH_CLIENT_SECRET=YOUR_CLIENT_SECRET

# If you are deploying to a custom domain, you will need to set the `WEB_DOMAIN` environment variable.
WEB_DOMAIN=https://YOUR_ONYX_DOMAIN.com
```

```bash values.yaml theme={null}
auth:
  secrets:
    OAUTH_CLIENT_ID: <CLIENT_ID_FROM_GOOGLE>
    OAUTH_CLIENT_SECRET: <CLIENT_SECRET_FROM_GOOGLE>
configMap:
  AUTH_TYPE: google_oauth
```
