Set up the Gmail connector
Configure the Gmail connector in AI Studio under Connectors & Tools. The Gmail connector supports two authentication options:- WRITER-managed OAuth (recommended): Writer provides the OAuth application. No setup required, just authorize access to your Gmail account when you first use the connector.
- Organization-managed OAuth: Create your own Google OAuth application for custom branding and control.
Most users should choose WRITER-managed OAuth for faster setup. Only use organization-managed OAuth if you need custom branding or have specific security requirements.
Google OAuth credentials expire after 6 months of inactivity. If the Gmail connector is not used for 6 months, users will need to re-authenticate.
Create a Google OAuth application (organization-managed only)
If you choose to create a self-managed OAuth application to connect, first create a new Google OAuth application in the Google Cloud Console:- Navigate to the Google Cloud Console
- Create a new project or select an existing project
- Enable the Gmail API for your project
- Configure the OAuth consent screen with your application details
- Create OAuth 2.0 credentials (Web application type)
- Add the Writer redirect URI to authorized redirect URIs:
- Configure the required OAuth scopes for your application
- Copy the client ID and client secret for use in AI Studio
Required OAuth scopes
https://www.googleapis.com/auth/gmail.labels- View and manage labelshttps://www.googleapis.com/auth/gmail.send- Send email on the user’s behalfhttps://www.googleapis.com/auth/gmail.readonly- View email messages and settingshttps://www.googleapis.com/auth/gmail.compose- Manage drafts and compose emailshttps://www.googleapis.com/auth/gmail.insert- Add emails to the mailboxhttps://www.googleapis.com/auth/gmail.modify- Modify email metadatahttps://mail.google.com/- Full Gmail access
OAuth scopes are fixed per connector and cannot be customized based on enabled tools. When users authorize the Gmail connector, they will grant all the scopes listed above, even if you disable certain tools in AI Studio.
Configure the connector in AI Studio
- Navigate to Connectors & Tools in AI Studio
- Select the Gmail connector
- Select who has access by default (all users or specific teams)
- Select the connection type:
- Level: User level (each user authenticates their own account) or org level (shared connection to a single account)
- Managed by: WRITER-managed or self-managed (your own OAuth app)
- Select which tools to enable for your agents
- Enter your OAuth client ID and client secret (if using self-managed OAuth)
- Complete the OAuth authorization flow
Next steps
- Set up connectors: Learn how to configure and enable connectors in AI Studio
- Tool calling guide: Understand how AI agents use tools in conversations
- Action Agent guide: Learn how to use Action Agent with connected tools
- MCP gateway overview: Learn about Writer’s MCP gateway architecture