The Google Gatekeeper connects Cloudflare OS to Google Workspace via OAuth 2.0, giving agents and Gadgets the ability to read and write Google Docs, work with spreadsheet data in Sheets, manage calendar events, access Gmail mailboxes, and query BigQuery datasets. It also powers “Continue with Google” sign-in using minimal identity scopes, entirely separate from the broader data-access scopes requested when you connect a specific Google resource.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/cloudflare-os/llms.txt
Use this file to discover all available pages before exploring further.
The Google Gatekeeper uses incremental scopes — sign-in requests only
openid, userinfo.email, and userinfo.profile. Full data-access scopes (e.g., documents, gmail.modify) are only requested when a user connects a specific resource type. This means sign-in is always fast and low-friction, while data scopes remain narrow and purposeful.Capabilities
The scopes requested by the Google Gatekeeper depend on what the user is connecting:| Resource type | Scopes requested | What agents can do |
|---|---|---|
| Sign-in | openid userinfo.email userinfo.profile | Read verified email for identity only |
| Google Docs | documents drive.metadata.readonly + identity | Read and write document content |
| Google Sheets | spreadsheets.readonly drive.metadata.readonly + identity | Read metadata and cell values |
| Google Calendar | calendar.calendarlist.readonly calendar.events + identity | List calendars, read/write events, check availability |
| Gmail | gmail.modify + identity | Read threads, reply, forward, send, manage labels |
| BigQuery | bigquery + identity | Run read-only SQL queries and explore datasets |
BigQuery uses the
bigquery scope rather than bigquery.readonly because dry-run jobs require jobs.insert. The gatekeeper enforces read-only SQL and resource scope checks in the session layer before any query is executed.drive.metadata.readonly) is used only to search and display document and spreadsheet metadata in the resource pickers. Document reads and edits continue to go through the Google Docs API; spreadsheet reads go through the Google Sheets API.
Setting Up Google OAuth Credentials
Create a Google Cloud project
- Go to the Google Cloud Console.
- Click the project dropdown at the top of the page and choose New Project.
- Enter a project name (e.g., “My Company OS”) and click Create.
- Select the new project from the dropdown once it is ready.
Enable the required APIs
In the left sidebar, go to APIs & Services → Library and enable each API you plan to use:
- Gmail API (for Gmail mailbox access)
- Google Docs API (for Google Docs read/write)
- Google Drive API (for document metadata in resource pickers)
- Google Sheets API (for spreadsheet data)
- Google Calendar API (for calendar events and availability)
- BigQuery API (for dataset queries)
Configure the OAuth consent screen
In the left sidebar, go to APIs & Services → OAuth consent screen.
- Select External as the user type (or Internal for a Google Workspace organization).
- Click Create and fill in an app name and any required fields.
- On the Scopes page, you can skip adding scopes manually — the consent screen is controlled by the OAuth request itself, not the console configuration.
- On the Test users page, add the email addresses of any users who should be able to sign in while the app is in Testing mode.
While the app is in Testing mode, only addresses listed as Test Users can complete the OAuth flow. Add every developer or tester who needs access during setup.
Create OAuth credentials
- In the left sidebar, go to APIs & Services → Credentials.
- Click Create Credentials → OAuth client ID.
- For Application type, choose Web application.
- Under Authorized redirect URIs, add:
http://localhost:8787/gatekeeper/google/oauthfor local development${PUBLIC_BASE_URL}/gatekeeper/google/oauthfor production
- Click Create and copy the Client ID and Client secret from the popup.
Configure credentials
Create a
.env file in the gatekeeper package directory:packages/gatekeeper-google/.env
The
.env file is gitignored and should never be committed to source control.Enable Google sign-in (optional)
To show “Continue with Google” on the login page, add Sign-in only needs the identity scopes, which are always available. No additional Google configuration is required for sign-in specifically, though the signing-in user must be listed as a Test User while the app is in Testing mode.
google to the AUTH_GATEKEEPERS allowlist:.dev.vars
Observer Tracking for Google Resources
Cloudflare OS tracks what external data a Gadget reads so that it can correctly verify collaborator access when a Gadget is shared. Google resources follow different strategies depending on the resource type:| Resource | Sharing behavior |
|---|---|
| Google Docs | Collaborator must connect their own Google account and verify access to the specific document |
| Google Sheets | Collaborator must connect their own Google account and verify access to the specific spreadsheet |
| Google Calendar | Collaborator must verify access to the specific calendar |
| Gmail | Private-only — observer access is always denied. Gmail mailboxes are never shared through a Gadget |
| BigQuery | Collaborator must verify access to the specific dataset |
Example Agent Prompts
Here are some prompts you can use once Google resources are connected:Troubleshooting
"redirect_uri_mismatch" error
"redirect_uri_mismatch" error
The redirect URI in your OAuth credentials does not match what the application is sending. Verify that
http://localhost:8787/gatekeeper/google/oauth (no trailing slash, http not https for localhost) is listed under Authorized redirect URIs in the Google Cloud Console."access_denied" error
"access_denied" error
Two common causes: (1) the signing-in user is not listed as a Test User while the app is in Testing mode — add their email in the OAuth consent screen settings; (2) the user clicked Cancel on Google’s consent screen — ask them to try again and click Allow.
"invalid_client" error
"invalid_client" error
Your
CLIENT_ID or CLIENT_SECRET is incorrect. Double-check the values in your .env file match exactly what is shown in the Google Cloud Console.OAuth consent screen shows "unverified app" warning
OAuth consent screen shows "unverified app" warning
This is normal for apps in Testing mode. Click Advanced and then Go to [app name] (unsafe) to proceed during development.