# Set up Google Workspace single sign-on

This guide gets people signing in to Weavestream with their Google Workspace accounts. You do everything in two places: the Google Cloud console and **Admin → Settings → Single sign-on** in Weavestream. No server access or environment variables are needed.

You need to be a Weavestream super admin (the Single sign-on settings are SUPER_ADMIN only) and a Google Workspace user who can create a project in your organization's Google Cloud.

> This is not the [Google Workspace integration](/integrations/google-workspace/). The integration syncs people, devices and groups; this guide is about signing in. Each needs its own Google Cloud project (see [step 1](#1-create-a-google-cloud-project)).

> If your deployment sets `SSO_OIDC_ISSUER` in its environment, the settings tab is read-only and says "Managed by environment variables". The environment wins. See [Environment variables](/configuration/environment/#single-sign-on-oidc).

Throughout, replace the placeholders with your own values: `<client-id>`, `<secret-value>` and `<weavestream-api-url>`.

## How Google differs from Entra

| Topic | With Google Workspace |
|---|---|
| **Who can sign in** | Google uses one issuer, `https://accounts.google.com`, for every Google account in the world. The **Internal** audience of your Google project ([step 2](#2-configure-the-app-with-an-internal-audience)) is what limits sign-in to your organization. Weavestream does not check the Workspace domain itself, and **Allowed tenant ID** is for Microsoft Entra only. |
| **Two-factor** | Weavestream always asks for its own two-factor code after a Google sign-in. Google does not report MFA in the ID token Weavestream receives, so **Trust the provider's multi-factor sign-in** has no effect. |
| **Step-up for sensitive actions** | People confirm with their Weavestream two-factor code. Google does not support asking someone to sign in again for this. |
| **Extra claims** | None to configure. The default scopes already return `email` and `email_verified`. |

## Before you start

1. In Weavestream, open **Admin → Settings → Single sign-on**.
2. Tick **Enable single sign-on**. The other fields appear only while it is ticked. Do not save yet.
3. Choose **Other OpenID Connect provider**.
4. Copy the **Callback URL** (the **Copy** button). It looks like `<weavestream-api-url>/v1/auth/sso/callback`. You will paste it into Google in step 3.

Google accepts a callback URL only if it uses `https` and a real host name. Plain `http` works only for `localhost`, and a raw IP address is refused. If the callback URL looks wrong, the deployment's `API_URL` is not set to the public address. Fix that first.

## 1. Create a Google Cloud project

1. Open the [Google Cloud console](https://console.cloud.google.com) with an account in your Google Workspace organization.
2. Create a new project, for example `Weavestream SSO`.
3. Set its **Organization** to your Workspace organization. **Internal** is offered in step 2 only for a project that belongs to an organization.

Use a project of its own. The audience applies to the whole project, so do not share it with the Google Workspace integration or any other app that needs an **External** audience.

## 2. Configure the app with an Internal audience

1. In the project, open **Google Auth Platform** and select **Get started**.
2. Enter an **App name**, for example `Weavestream`, and a **User support email**.
3. Under **Audience** choose **Internal**.
4. Enter a contact email address, accept Google's policy, and create the app.

!!!warning Do not use External
With an **External** audience, Google can let any Google account reach Weavestream, including personal Gmail accounts. With **Create accounts automatically** on, those people would get an account, and with **Link accounts by email** on, the match would rest only on Google's word for an address outside your organization.
!!!

You do not need to add scopes, publish the app or send it for verification. Weavestream asks only for `openid`, `profile` and `email`.

## 3. Create the OAuth client

1. Open **Google Auth Platform → Clients → Create client**.
2. For **Application type** choose **Web application** and give it a name.
3. Leave **Authorized JavaScript origins** empty.
4. Under **Authorized redirect URIs** add the **Callback URL** you copied from Weavestream. It must match exactly.
5. Select **Create**.
6. Copy the **Client ID** (`<client-id>`, it ends in `.apps.googleusercontent.com`) and the **Client secret** (`<secret-value>`) straight away. Google shows the secret only now.

Google says a change to a client can take from 5 minutes to a few hours to take effect. It also deletes a client that is unused for six months.

## 4. Enter the values in Weavestream

In **Admin → Settings → Single sign-on**:

1. Tick **Enable single sign-on** if it is not ticked, and choose **Other OpenID Connect provider**.
2. Set **Provider name** to what people should see, for example `Google`. The button will read "Sign in with Google".
3. Set **Issuer URL** to exactly `https://accounts.google.com`, with no trailing slash.
4. Paste `<client-id>` into **Client ID**.
5. Paste `<secret-value>` into **Client secret**. Do this after the issuer and client ID: changing either one empties the secret.
6. Leave **Scopes** as `openid profile email`. Without `email`, nobody can be matched on first sign-in.
7. Leave **Allowed tenant ID** (under **Advanced settings**) empty. A value there blocks every Google sign-in.
8. Choose the account rules (you can change them later):
   - **Link accounts by email**: turn on if your people already have Weavestream accounts with the same email address as in Google. Super admins and accounts with platform capabilities are never linked this way (step 6).
   - **Create accounts automatically**: turn on only if everyone in your Workspace organization should get an account. New accounts have no access until you grant it.
   - **Trust the provider's multi-factor sign-in**: leave off. It has no effect with Google.
9. Leave **Allow password sign-in** on for now.
10. Select **Save single sign-on settings**. Confirm with your usual two-factor code or password when asked.

To limit sign-in to some of your people, leave **Create accounts automatically** off. Then only someone who already has a Weavestream account, linked to Google by email or by hand, can sign in. You can also manage the app per organizational unit in the Google Admin console, under **Security → Access and data control → API controls**.

## 5. Test the connection

Select **Test connection**. It checks, from the Weavestream server, that Google's discovery document and signing keys can be fetched, that the issuer matches, and that this deployment can finish a sign-in (`API_URL` is under the same origin as `APP_URL`).

It does not sign anyone in. It **cannot** check the client ID, the client secret, the redirect URI or the Internal audience. Step 6 does.

## 6. Link your own admin account

Super admins and accounts with platform capabilities are never linked by email, so link yours yourself. This is also what makes it safe to turn off password sign-in later.

1. Sign in the usual way (password and two-factor code), then click your avatar and open **Profile → Security → Single sign-on**.
2. Choose **Link Google account**, confirm when asked, and pick your Workspace account at Google.
3. You return to **Profile** with a message that the account is linked.
4. Sign out, choose **Sign in with Google**, and enter your Weavestream two-factor code. You should land in Weavestream.

Then check the audience: in a private window, choose **Sign in with Google** and pick a personal Gmail account. Google must refuse it with `org_internal`. If Google lets it through, the audience is not **Internal**: turn single sign-on off until step 2 is fixed.

Other accounts with platform capabilities must link themselves the same way, while they can still sign in with a password. Everyone else is linked on first sign-in (if you enabled **Link accounts by email**), or can link themselves from the same place. Someone who has no Weavestream two-factor yet is asked to set it up on first sign-in.

## 7. Optionally turn off password sign-in

Once at least one super admin has linked their account, and every account with platform capabilities has linked itself (step 6):

1. Return to **Admin → Settings → Single sign-on**.
2. Untick **Allow password sign-in** and save.

Everyone except super admins must now use Google, including in sessions already open. Super admins keep password sign-in so that a Google problem cannot lock you out. Read [Break-glass](/guides/sso-microsoft-entra/#break-glass) before you do this; it applies to Google too.

## Troubleshooting

Google shows some errors on its own page. Weavestream's errors appear on the login page and are deliberately generic: the detail is in the audit log (`auth.sso.login.failure`, with a fixed reason code, never a token) and the API log.

| What you see | Likely cause | What to do |
|---|---|---|
| Google: `redirect_uri_mismatch` | The redirect URI in Google differs from the Callback URL, or the change has not taken effect yet. | Copy the Callback URL again into the client (step 3), then wait. |
| Google: `org_internal` | The account is outside your organization. | Expected for personal accounts. Otherwise check that the project is in the right organization (step 1). |
| Google: `admin_policy_enforced` | A Google Workspace admin policy blocks the app. | Allow the client ID in the Admin console under **API controls**. |
| Google: `invalid_client` or `deleted_client` | The client ID is wrong, or the client was deleted. | Check the **Client ID**, or create a new client (step 3). |
| "Single sign-on failed", audit reason `token_exchange_failed` | Most often the client secret is wrong, disabled or deleted. | Add a new secret to the client in Google, then in the tab choose **Replace**, paste it and save. |
| "Single sign-on failed" or "Linking failed", audit reason `invalid_token` | Google answered, but Weavestream refused the ID token. `detail` in the same audit row names the check. | `audience`: the **Client ID** must be the complete value from Google, ending in `.apps.googleusercontent.com`. `not_before`: correct the server clock. `signing_keys_unavailable`: allow the server to reach `www.googleapis.com`. |
| "No Weavestream account matches", audit reason `no_account` | Nobody has that email address, and **Create accounts automatically** is off. | Create the user, or turn on automatic accounts. |
| Same message, audit reason `link_by_email_disabled` | The user exists but is not linked. | Turn on **Link accounts by email**, or have the person link from **Profile**. |
| Same message, audit reason `no_email` | **Scopes** does not include `email`. | Restore `openid profile email`. |
| "Not allowed", audit reason `privileged_account` | Super admins and accounts with platform capabilities are never linked by email. | Link from **Profile** (step 6). |
| "Not allowed", audit reason `pending_invite` | The person has not accepted their Weavestream invite. | Have them accept the invite, then sign in with Google. |
| "Not allowed", audit reason `tenant_mismatch` | **Allowed tenant ID** holds a value. | Empty it (step 4). |
| Test connection says the issuer differs | The issuer has a trailing slash or a path. | Use exactly `https://accounts.google.com`. |
| A two-factor code is asked after every Google sign-in | Google does not report MFA to Weavestream. | Expected. |
