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

# Google Workspace

> Sync volunteers from your Google Workspace directory, and let them sign in with their Google work account.

Google Workspace does not push changes to most apps, so Scoutworks reads your directory instead: **directory sync**. You choose which people it reads, by Google group or by organisational unit, and it never reads anything else. Sign-in uses Google, limited to your verified domain, or a custom SAML app.

You need a Google **super admin** for the first consent (or an admin with read access to users and groups, if your organisation uses delegated admin roles), and admin access to your group or district in Scoutworks.

## 1. Verify your domain in Scoutworks

In Scoutworks, open **Settings → Sign-in and directory**, choose **Google Workspace**, and add your domain, for example `1stexample.org.uk`. Publish the TXT record it shows in your DNS, then press **Check now**. See [Verified domains](https://developers.scoutworks.app/scim-sso/safety.md#verified-domains).

## 2. Set up directory sync

**1. Connect Google Workspace**

In the wizard, at **Set up provisioning**, press **Connect Google Workspace** and sign in as your Google admin. Google asks you to let Scoutworks read your directory. Scoutworks asks for these scopes only, all read-only:

* users (`admin.directory.user.readonly`)
* groups (`admin.directory.group.readonly`)
* group members (`admin.directory.group.member.readonly`)
* your customer ID (`admin.directory.customer.readonly`)

Scoutworks stores Google's refresh token encrypted. It never writes to your directory.

**2. Choose who Scoutworks reads**

Choose one of these. Scoutworks never reads your whole directory.

* **Access groups (recommended).** Pick the Google groups that hold your volunteers, such as `leaders@1stexample.org.uk` and `trustees@1stexample.org.uk`. Scoutworks reads their members, including members of groups nested inside them, up to 5 levels deep. Each group can then be mapped to a role.
* **An organisational unit.** Pick an OU, such as `/Volunteers`. Scoutworks reads its users and the units under it. Groups do not grant anything with this choice, so every person gets the connection's default access.

**3. Map groups, preview and turn it on**

Map each Google group to a role, sections and job flags, check the preview, and turn the connection on.

Scoutworks then reads the chosen scope **every 15 minutes**, and also asks Google to tell it when a user changes (a `users.watch` push channel), so most changes arrive within a minute or two. A push only tells Scoutworks to look again: it never changes anyone on its own.

### What each change in Google does

| In Google | In Scoutworks |
| - | - |
| Add a person to an access group, or to the OU | Created, and given the access their mapped groups grant |
| Change their name, phone, or groups | Updated at the next sync |
| Suspend or archive them | Their access is suspended in the groups this connection manages |
| Take them out of every access group, or out of the OU | Suspended at once; removed after 7 days out of scope |
| Delete them | Removed |
| Restore them within 30 days | Their access and history come back |

The fields Scoutworks reads: `id`, `primaryEmail`, `name.givenName`, `name.familyName`, `suspended`, `archived`, the mobile number in `phones`, and the organisation ID in `externalIds` (their Scout membership number, if you keep it there).

### If the admin who connected it leaves

The refresh token belongs to the admin who consented. If their account is suspended, or they remove Scoutworks' access, Google refuses the token: the connection moves to **error**, the sync stops with nobody changed, and your Scoutworks admins get one email. Connect Google Workspace again with another admin, then resume the connection.

To avoid this, use **domain-wide delegation** instead: create a service account in Google Cloud, authorise its client ID in **Admin console → Security → Access and data control → API controls → Domain-wide delegation** with the four scopes above, and give Scoutworks the service account's JSON key and the email of an admin it acts as. Scoutworks checks that it can read your customer ID before saving it, and stores the key encrypted.

One Google Workspace organisation can be connected to one connection per group or district.

## 3. Google's SCIM provisioning (beta)

Google is testing automatic provisioning for custom SAML apps with your own SCIM endpoint (custom SCIM profiles), for a limited set of organisations. If your Admin console offers **Autoprovisioning** on the custom SAML app below, you can use it beside directory sync: give it the same **tenant URL** and **secret token** the wizard shows for SCIM:

```text theme={null}
https://api.scoutworks.app/scim/v2/{connectionId}
```

Google reads `/Schemas` to find the attributes it can send, so the mapping screen lists everything Scoutworks accepts (see the [SCIM reference](https://developers.scoutworks.app/scim-sso/scim-reference.md#user-attributes)). Google's SCIM does not send group membership, so keep directory sync on for your access groups.

## 4. Set up sign-in

### Google sign-in (recommended)

Choose **Sign in with Google** in the wizard. Nothing is needed in the Admin console. Scoutworks accepts only Google accounts whose hosted domain (`hd`) is one of your verified domains, with a verified email address on that same domain: a personal Gmail account, or another organisation's account, is refused.

Press **Test sign-in**. It must pass before you can go on.

### A custom SAML app (the alternative)

**1. Add the app**

In the Admin console, go to **Apps → Web and mobile apps → Add app → Add custom SAML app**, and name it "Scoutworks".

**2. Give Scoutworks Google's details**

On **Google Identity Provider details**, download the metadata (or copy the SSO URL, entity ID and certificate) and add it to the wizard.

**3. Give Google Scoutworks' details**

| Google field | Value |
| - | - |
| ACS URL | `https://api.scoutworks.app/api/auth/saml/{connectionId}/acs` |
| Entity ID | `https://api.scoutworks.app/api/auth/saml/{connectionId}/metadata` |
| Start URL | `https://api.scoutworks.app/api/auth/sso/tenant/{connectionId}/start` |
| Signed response | Optional. If you turn it on, Scoutworks checks that signature too |
| Name ID format | `EMAIL` |
| Name ID | Basic Information → Primary email |

**4. Map attributes**

Map **Primary email** → `email`, **First name** → `firstName`, **Last name** → `lastName`. Under **Group membership**, you can send `groups`.

**5. Turn it on**

Turn the app **ON for everyone** in the organisational units or groups that hold your volunteers, then press **Test sign-in** in Scoutworks.

Volunteers can then open Scoutworks from the Google app launcher.

## Next

* [Require work-account sign-in](https://developers.scoutworks.app/scim-sso/safety.md#requiring-work-account-sign-in), with break-glass admins.
* Let a county's or district's Google Workspace provision the groups below it: [Delegated provisioning](https://developers.scoutworks.app/scim-sso/safety.md#delegated-provisioning).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.