Set Up Google Directory

In this guide, you will configure Google as an identity provider for Guardrails. Unlike the other directory types which use SAML, Google authentication uses OAuth 2.0. Users sign in with their Google Workspace accounts, and Guardrails restricts access to a specific hosted domain, so only members of your organization can authenticate.

This is a three-step process: create an OAuth client in Google Cloud, create the directory in Guardrails, then finish configuration in Google Cloud with the callback URL.

Prerequisites

Step 1: Create an OAuth Client in Google Cloud

  1. Sign in to the Google Cloud Console.

  2. Navigate to APIs & Services > Credentials.

  3. Click Create Credentials > OAuth client ID.

  4. Select Web application as the application type.

  5. Enter a name for the client (for example, Turbot Guardrails).

  6. Leave Authorized JavaScript origins and Authorized redirect URIs empty for now. You'll add these after creating the directory in Guardrails.

  7. Click Create.

  8. Copy the Client ID and Client Secret. You'll need both when configuring the directory in Guardrails.

Step 2: Create the Google Directory in Guardrails

  1. Navigate to Workspace > Directories.

  2. Click Create Directory and select Google.

  3. Fill in the directory details:

FieldDescription
TitleDisplayed on the login screen. Example: Acme Corp Google.
DescriptionOptional. A note about the directory's purpose.
Hosted DomainYour Google Workspace domain (e.g., acme.com). Guardrails restricts login to this domain only.
Client IDThe OAuth client ID from step 1.
Client SecretThe OAuth client secret from step 1.
Profile ID TemplateTemplate for generating profile IDs. The default {{profile.email}} works for most cases. This cannot be changed after creation.
  1. Click Create.

  2. The directory appears in the list with a New status. Click the directory to open its detail view, and copy the Callback URL. You'll need this for the next step.

Step 3: Complete Configuration in Google Cloud

  1. Go back to the Google Cloud Console and open the OAuth client you created in step 1.

  2. Under Authorized JavaScript origins, click Add URI and enter your Guardrails console URL (e.g., https://your-workspace.cloud.turbot.com).

  3. Under Authorized redirect URIs, click Add URI and paste the Callback URL you copied from the Guardrails directory.

  4. Click Save.

Step 4: Activate and Test

  1. Back in Guardrails, navigate to Workspace > Directories.

  2. Click the Activate action on the new Google directory.

  3. Open an incognito or private browser window.

  4. Navigate to your Guardrails workspace URL.

  5. Select the new Google directory from the login dropdown and sign in with a Google Workspace account from the configured domain.

  6. After signing in, a new profile is created automatically. The user has no permissions until an administrator grants them.

Troubleshooting

IssueSolution
Login fails with a redirect errorVerify the Authorized redirect URI in Google Cloud matches the Callback URL from the Guardrails directory exactly, including the protocol and trailing path.
Directory doesn't appear on the login screenConfirm the directory is Active on the Workspace > Directories page.
Users from outside the domain can't sign inThis is expected. The Hosted Domain setting restricts authentication to the specified domain.
Profile fields are empty after loginVerify the Google Workspace account has a first name, last name, and email configured.

Next Steps