Connect Gmail, Google Calendar and Drive to your AI agents
Publish Gmail, Google Calendar and Google Drive in a Metorial portal with per-user Google sign-in, your own Google Cloud OAuth client and read-only scopes.
In Metorial, Gmail, Google Calendar and Google Drive are separate integrations, each with Google OAuth sign-in, so you publish only the products people need. Each employee signs in with their own Google account, and the agent reads mail, events and files as that person. One Google Cloud OAuth client of your own can serve all three.
What you'll learn
- How an admin publishes the Google integrations and how an employee connects
- Which scopes each integration can request, and which ones are read-only
- How to use your own Google Cloud OAuth client
Before you start
- A portal with at least one access group
- A Google account for each person who will connect
- To use your own OAuth client: a Google Cloud project you can edit
Sign-in method
Each of the three integrations has one method: Google OAuth. Metorial asks Google for offline access, so the connection keeps working after the person closes the browser. There is no API key or service account method.
Admin: publish the Google integrations
In the dashboard
Open Shared Resources
Open Workforce, choose the portal, and select Shared Resources under Access.
Share each product
Select Share a Resource, then New Integration, and choose Gmail. For how members connect, choose Each person connects. Repeat for Google Calendar and Google Drive.
Choose who gets them
Add the access groups that should see each one. You can give Calendar to everyone and Gmail to a smaller group.
With the CLI
The CLI cannot create the per-user integrations. Once they exist, list who has them:
Employee: connect your Google account
In the portal
Open the integration
Sign in to your portal and open Gmail, Google Calendar or Google Drive.
Authenticate
Under Quick setup, select Authenticate. A Google tab opens. Choose your account and allow the permissions listed.
Confirm
The status changes to Configured. Connect each Google product you need. They are separate connections.
With the CLI
Scopes
Google scopes are full URLs that start with https://www.googleapis.com/auth/. The tables show the last part.
| Gmail | Access |
|---|---|
gmail.readonly | Read messages and settings |
gmail.send | Send only |
gmail.compose | Create drafts and send |
gmail.modify | Read, send, and change labels and state |
gmail.labels | Manage labels |
https://mail.google.com/ | Full access, including permanent delete |
| Google Calendar | Access |
|---|---|
calendar.readonly | Read all calendars |
calendar.events.readonly | Read events |
calendar.events | Read and change events |
calendar.freebusy | See free and busy times only |
calendar | Full access |
| Google Drive | Access |
|---|---|
drive.readonly | Read all files |
drive.metadata.readonly | Read file names and properties, not content |
drive.file | Only files the app created or the person opened with it |
drive | Full access |
Each integration offers more scopes than listed here, for example Gmail settings and Calendar sharing. You choose the set in the Scopes picker when you create your own auth credentials. For a read-only setup, allow the scopes under Read-Only Scopes and reject the rest.
Google classifies many Gmail and Drive scopes as sensitive or restricted. If your Google Cloud app is for use only inside your Google Workspace organization, those scopes need no review by Google.
Use your own Google Cloud OAuth client
Start the credentials in Metorial
In the dashboard, select Settings, then Organization Settings. Under Integrations and MCP, select Provider Auth, then Create Auth Credentials. Choose Gmail and copy the Redirect URI.
Enable the APIs
In the Google Cloud console, go to APIs & Services, Library, Google Workspace. Open the Gmail API and click Enable. Do the same for the Calendar API and the Drive API.
Configure consent
Go to Google Auth platform, Branding. If it is not configured yet, click Get Started, enter an app name and support email, and under Audience select the user type. Choose internal when only people in your Google Workspace organization will connect.
Create the client
Go to Google Auth platform, Clients and click Create Client. For Application type, choose Web application. Under Authorized redirect URIs, click Add URI and paste the redirect URI from Metorial. Click Create, then copy the client ID and client secret. Google shows the secret only at this point.
Finish in Metorial
Enter a Name, the Client ID and the Client Secret, select scopes, and select Create. Create credentials for Google Calendar and Google Drive the same way. You can reuse the same Google client: add each redirect URI Metorial shows to its Authorized redirect URIs.
Google's own steps are in Enable Google Workspace APIs, Configure the OAuth consent screen and Create access credentials.
Make the connection read-only
After you narrow the scopes, open the integration's Tool Filters and set the write and destructive tool groups to Reject. For Gmail, that keeps search_messages and get_message and removes send_email and the two permanent delete tools. See Tool permissions.
Check it worked
Troubleshooting
redirect_uri_mismatch
Google returns this error when the redirect URI in the request is not listed on the OAuth client. Copy the Redirect URI from Metorial again and add it to Authorized redirect URIs exactly as shown.