Skip to main content

Set up Google Workspace for authentication

If your organization runs on Google Workspace, connect it to SecureAuth Connect so users sign in with the accounts they already have, and policies can match on their Google groups. Group matching needs a Google service account, plus one claim change if you use Agent Authority. This guide is for administrators connecting a Google Workspace organization to a SecureAuth Connect workspace.

This page covers Google Workspace as a sign-in provider for your organization. To let any Google account sign in to a consumer application, see Google social login instead.

How the integration works​

Sign-in and groups come from two different places in Google, which is why groups need extra setup.

Google Workspace acts as an external identity provider (IdP) over OpenID Connect (OIDC). When a user signs in, SecureAuth redirects them to Google, verifies the ID token that comes back, and issues its own tokens to the application.

Groups need one more step, because Google's ID token does not include them. When Fetch groups is on, SecureAuth looks up the user's groups at each sign-in. It uses a Google service account to call the Google Admin SDK Directory API. Each group arrives as its email address, such as engineering@example.com, not its display name.

Before you begin​

SecureAuth needs credentials from Google before it can send users there to sign in.

In the Google Cloud console, create an OAuth client ID of type Web application. Follow Google's guide to setting up OAuth 2.0.

To fetch groups, you also need:

  • A service account key – A service account with a JSON key. Enable the Admin SDK API in the service account's project.
  • Domain-wide delegation – In the Google Admin console, authorize the service account's client ID for the https://www.googleapis.com/auth/admin.directory.group.readonly scope. Follow Google's guide to domain-wide delegation. This lets the service account read groups on behalf of an administrator.
  • An administrator account – The email address of a Google Workspace user who can read groups in the Admin console. The service account acts as this user when it looks up groups.

Create the connection​

The connection puts Google Workspace on your sign-in page and gives Google an address to send users back to.

  1. In your workspace, go to Authentication > Providers, then click Create Connection.

    note

    In the Agentic AI workspace, the same page is at Identity > Identity Providers.

  2. Click the Google Workspace template.

    The Create Connection page showing identity provider templates, with the Google Workspace template highlightedThe Create Connection page showing identity provider templates, with the Google Workspace template highlighted
  3. Copy the Redirect URL from the form and add it as an authorized redirect URI on the Google OAuth client. This lets Google return the user to SecureAuth after they sign in.

  4. Complete the remaining fields:

    • Name – Enter a name that helps users recognize this provider on the sign-in page.
    • Client ID – Enter the client ID of the Google OAuth client.
    • Client Secret – Enter the client secret of the Google OAuth client.
    The Google Workspace connection form with the Name, Client ID, Client Secret, and Redirect URL fieldsThe Google Workspace connection form with the Name, Client ID, Client Secret, and Redirect URL fields

    Provision users automatically is on when the workspace has exactly one identity pool, which the switch names. With several pools it starts off, so turn it on and pick one. See Automatic user provisioning for what this means for the connection you're creating.

  5. Save your changes.

The connection appears in the list of providers. Open it to reach its Configuration tab.

Test the connection​

Testing sign-in now catches a wrong client ID, secret, or redirect URL before you set up groups on top of it.

  1. Confirm the provider is enabled in the list of providers.

  2. Open an application that uses SecureAuth for sign-in, or the built-in User Portal.

  3. Start a sign-in and select the Google Workspace provider by the name you gave it.

  4. Sign in with a Google Workspace account.

Configure advanced settings​

Sign-in works without these settings. Use them to limit sign-in to your own domains or to bring in groups.

On the connection's Configuration tab, expand Advanced settings. These settings only appear after the connection exists.

SettingDescription
ScopesAdd scopes to request from Google. SecureAuth requests openid, email, and profile by default.
Authentication Method ReferenceSelect an authentication method to write into the amr claim. The selected value replaces any value from Google.
Hosted DomainsEnter the Google Workspace domains allowed to sign in. A user from any other domain is rejected. Leave empty to allow every domain.
Fetch groupsRead the user's groups from Google at sign-in. Requires Admin Email and Service Account.
Admin EmailEnter the email address of the administrator account the service account acts as. Appears when Fetch groups is selected.
Service AccountPaste or upload the service account's JSON key. Appears when Fetch groups is selected.
Parameters forwarded to IdPSelect which parameters from the original sign-in request SecureAuth passes on to Google, such as login_hint.

Turn on group fetching​

Without this, users sign in with no groups, so no rule that names a group matches them.

  1. On the Configuration tab, under Advanced settings, select Fetch groups.

  2. Enter the Admin Email, and paste or upload the Service Account key.

  3. Save your changes.

You don't need to change any mappings. By default, the fetched groups go to List of groups that user belongs to in the authentication context.

If sign-in fails after you turn this on, check the service account key, the domain-wide delegation scope, and the Admin Email.

Use Google Workspace groups in Agent Authority policies​

Skip this section unless you use an Agentic AI workspace with SecureAuth Agent Authority.

Agent Authority reads the workspace's groups claim, and that claim gets its groups from the identity pool by default. After you turn on Fetch groups, point the claim at the authentication context so it carries the groups from Google Workspace.

Point the workspace groups claim at Google Workspace​

This change applies to every application and sign-in method in the workspace, not just this connection. Identity-pool memberships are no longer released through this claim. Before changing it, check whether other applications or sign-in methods depend on identity-pool groups.

  1. Go to Identity > Token Claims and select the ID Tokens tab.

  2. Click the groups row. Its Type is User, which means it reads groups from the identity pool.

    Edit this claim rather than adding a new one. Claim names must be unique, so a second groups claim is rejected.

  3. Set Type to AuthN Context, and set Source to List of groups that user belongs to.

  4. Click Update.

  5. Leave User info only turned on for the groups row. This keeps groups out of the ID token while still returning them in the user info response, where Agent Authority reads them.

Write policies with group email addresses​

Google Workspace groups reach Agent Authority as email addresses. Use the full address in a policy, for example "engineering@example.com" in user.groups. A rule that names the group's display name, such as Engineering, never matches.

Check that groups arrive​

A misspelled group or a missed setting doesn't show an error: the rule just never matches. Checking one user now shows whether groups are getting through.

Sign in through Google Workspace as a user who belongs to a group. Then open the Users page in Agent Authority and confirm that the group's email address appears in the Groups column for that user.

SecureAuth reads groups only at sign-in. A change in Google Workspace reaches Agent Authority after the user disconnects their agent, connects it again, and signs in through Google Workspace. For more, see When a group change takes effect.

See also​