Gmail OAuth
Use OAuth when an authorized person can complete Google browser consent for the Gmail account to be indexed. An OpenCore Admin uploads the OAuth app JSON and maintains the resulting credential.
Prerequisites
Use Standard mode. In a Google Cloud Project controlled by your organization, enable the Gmail API and Admin SDK API, configure the OAuth consent screen, and create a Web application OAuth client. The person authorizing OpenCore must be allowed to grant every requested scope.
Create the web OAuth client
Add this Authorized redirect URI exactly, replacing <WEB_DOMAIN> with the public base URL of the OpenCore deployment:
<WEB_DOMAIN>/admin/connectors/gmail/auth/callback
Download the OAuth client JSON. OpenCore expects the downloaded object to contain web.client_id and web.client_secret; the standard Google download also supplies the authorization and token endpoints.
Keep the file protected. Upload it only through the Gmail credential screen, and never place it in source control, Agent instructions, or a shared document.
Configure requested scopes
OpenCore currently requests these three read-only scopes for Gmail OAuth:
The OAuth flow requests all three scopes. Directory user listing does not grant Gmail impersonation: the OAuth credential remains limited to the account that completed consent. Domain-wide mailbox coverage requires a Service Account with Domain-Wide Delegation.
Upload and authorize
- Sign in to OpenCore as an Admin and open Documents & Knowledge.
- Select Gmail, choose OAuth app, and upload or paste the OAuth client JSON.
- Select Authenticate with Gmail and complete Google’s consent flow with the account whose Gmail is approved for indexing.
- After the browser returns to OpenCore, confirm the credential appears in the credential list.
OpenCore reads the current Gmail profile after authorization and saves that email as the credential’s primary account. The OAuth credential can read only that account’s mailbox, even if the account is a Workspace administrator that can list Directory users. Domain-wide mailbox coverage requires a Service Account with Domain-Wide Delegation.
Verify the connector
Create a Gmail connector with an approved indexing start date. The default refresh frequency is 30 minutes and can be changed to another value of at least one minute. Run and review the first index attempt, confirm that only the expected mailbox threads are present, and inspect representative threads for usable plain-text content.
Troubleshooting
Related pages
- Gmail Overview explains indexed content, mailbox coverage, updates, and permission boundaries.
- Gmail Service Account covers organization-managed Domain-Wide Delegation.
- Connectors & Indexing explains document sets and index attempts.