Skip to content

Google Workspace connects with OAuth 2.0 through Truto's Google app or your own, or with a service account that has domain-wide delegation.

Install the Google Workspace integration

Install Google Workspace from Available integrations in each environment you connect accounts from.

Use your own Google Workspace OAuth app

Truto connects Google Workspace accounts through its own OAuth app, so this step is optional. To show your own app on the consent screen instead:

  1. Create an OAuth client in the Google Cloud console and add https://api.truto.one/connect/googleworkspace/callback as its redirect URL. If you use a redirect URL on your own domain, add that URL instead.
  2. Enter the app's Client ID and Client Secret on the installed Google Workspace integration. See Overriding OAuth credentials.

By default, Truto asks Google Workspace for these scopes. The Connect UI lists them under Permissions required, and you can change them when you override the OAuth credentials.

  • https://www.googleapis.com/auth/admin.directory.user
  • https://www.googleapis.com/auth/admin.directory.group.member
  • https://www.googleapis.com/auth/admin.directory.orgunit.readonly
  • https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/userinfo.profile
  • openid

Enable the same scopes on your app. If your app allows fewer, change the list under Use your own OAuth settings → Scopes on the installed integration's Configuration tab to match.

Authorise a service account

Skip this section if you connect with OAuth 2.0. To connect with a service account, a Google Workspace super admin authorises it once:

  1. In the Google Admin console, go to Security → Access and data control → API controls → Manage Domain Wide Delegation, and click Add new.
  2. Enter the service account's Client ID.
  3. Add these OAuth scopes, then click Authorize:
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.group.readonly
https://www.googleapis.com/auth/admin.directory.rolemanagement.readonly
https://www.googleapis.com/auth/admin.directory.user.security

Truto asks Google for exactly these four scopes. If any is missing, Google refuses the token and the connection fails.

Connect a Google Workspace account

  1. In Integrated Accounts, click Connect Account. Click Connect Account
  2. Enter a Tenant ID (your customer's ID; Truto creates the tenant if it is new), or pick one under Existing tenant (optional). Check the Environment and the Region (where Truto places the account; Western North America by default). To open the link straight on Google Workspace, pick it under Advanced settings → Integration (optional). Click Get connection link. Get connection link
  3. Click the open-in-new-tab button, or click Copy and send the link to your customer so they connect their own Google Workspace account. The link works for 7 days, until an account is connected with it. Share connection link
  4. Click Get Started if it shows, then select Google Workspace. Select Google Workspace
  5. Choose how to connect:
    • OAuth 2.0: log in as a Google Workspace admin and allow access to Truto.
    • API Key: connect through a Google Cloud service account with domain-wide delegation (see Authorise a service account). Enter the Email address of the Service Account, its Private Key (the private_key value from the service account's JSON key file), and the Impersonating User Email: a Google Workspace admin the service account acts as. Click Connect.
  6. Close the tab when you see Connection successful. The new account appears under Integrated Accounts. Click its Account ID to see its details and make API calls.

Check the scopes the user granted

Google lets users untick individual scopes on the OAuth consent screen, and the connection still succeeds. Right after it does, read the account with GET /integrated-account/{id} and compare context.oauth.token.scope with the scopes you need. If any are missing, ask the user to reconnect and grant them.

A connection validation request fails the connection when it needs a scope the user left out. A call that fails later for a missing scope returns 403 with truto_error_insight.forbidden_error.value.refusal_basis set to scopes_missing; see Insights.