MetorialDocs

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

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:

metorial-admin portals access list <portal-id> --type provider_template --search google

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

metorial catalog search gmail
metorial setup <catalog-item-id>

Scopes

Google scopes are full URLs that start with https://www.googleapis.com/auth/. The tables show the last part.

GmailAccess
gmail.readonlyRead messages and settings
gmail.sendSend only
gmail.composeCreate drafts and send
gmail.modifyRead, send, and change labels and state
gmail.labelsManage labels
https://mail.google.com/Full access, including permanent delete
Google CalendarAccess
calendar.readonlyRead all calendars
calendar.events.readonlyRead events
calendar.eventsRead and change events
calendar.freebusySee free and busy times only
calendarFull access
Google DriveAccess
drive.readonlyRead all files
drive.metadata.readonlyRead file names and properties, not content
drive.fileOnly files the app created or the person opened with it
driveFull 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

metorial list gmail
metorial tools <integration-id>
metorial call <integration-id> search_messages -d '{"query": "is:unread"}'

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.

Next steps