Set up Google as your SSO provider for Tonic
To configure Google SSO:
  1. 1.
    Create an OAuth 2.0 Client ID - Requires GCP project permissions to create credentials.
  2. 2.
    Create and configure a service account to read user groups - In addition to the above, requires the Google workspace administrator.
The OAuth client ID is sufficient to enable logging in with your Google account, but no groups are parsed. If the service account is misconfigured, the login succeeds without the groups being parsed and a warning is logged to the server with more details. For the provided links, it is assumed that the user is logged into their administrative account and using the same project.

Creating an OAuth 2.0 client id

  1. 2.
    Click Create credentials, located near the top.
Create Credentials option for Google
  1. 3.
    Select OAuth client ID.
Create OAuth Client ID panel
  1. 4.
    Select Web application as the application type.
  2. 5.
    Choose a name.
  3. 6.
    Under Authorized redirect URIs, add the URL of the Tonic server with the endpoint /sso/callback.
Redirect URIs
  1. 7.
    Note the client ID and client secret. You will need to provide them to Tonic.

Providing the client information to Tonic

Configure the following environment variables in the Tonic web server container:
  • TONIC_SSO_CLIENT_ID: <client id of oauth credentials>
  • TONIC_SSO_CLIENT_SECRET: <client secret of oauth credentials>

Create and configure a service account to read user groups

To set up the service account:

Create a service account with a json key

  1. 2.
    Click Create service account, located near the top
Create service account panel
  1. 3.
    Skip all the subsequent optional steps.
  2. 4.
    After you create the service account, select it and go into the Keys tab.
Keys tab
  1. 5.
    Select Add Key -> Create new key and select JSON as the key type. The browser automatically downloads a json file.
  2. 6.
    The json file must be base64 encoded to set it as a variable in your Docker Compose file. An example command to do this is: cat /path/to/json/file | base64 -w 0 The long output of this command is set as the value of TONIC_SSO_SERVICE_ACCOUNT_JSON_BASE64 in the Docker Compose file
  3. 7.
    Take note of the service account email. You will need this later.

Enable the Admin SDK API

  1. 2.
    Click Enable if it is not yet enabled.
Admin SDK API panel

Add the Groups Reader admin role to the service account

  1. 1.
    Go to and select Admin Roles.
  2. 2.
    Select Groups Reader from the list of predefined roles.
  3. 3.
    Click Assign Roles -> Assign service accounts.
  4. 4.
    Copy the service account email into the box, then click Add.
  5. 5.
    To save these changes, click Assign Role.

Providing the service account and group information to Tonic

In the Tonic web server container, set the following Tonic environment variables:
  • TONIC_SSO_SERVICE_ACCOUNT_JSON_BASE64: <base64 encoded json key>
  • TONIC_SSO_DOMAIN: <domain name> - The domain name is the workspace domain. For example, for [email protected], the domain is
  • TONIC_SSO_GROUP_FILTER_REGEX: <regex string> Optional. If not set, Tonic does not synchronize or load groups from your SSO provider. To synchronize groups, this must be set. The setting is used to limit the groups that will be imported to Tonic. Set this to a regular expression that matches the groups that Tonic should be aware of. For example, the expression .*Tonic.* allows all groups that contain the word "Tonic". To not limit the groups, set the value to .*.
For Kubernetes, TONIC_SSO_SERVICE_ACCOUNT_JSON_BASE64 can be provided through the tonic-sso-google-account-service-json-secret secret
Last modified 18d ago