Skip to content

Reference

Google

Set up Google OAuth for Gmail, Calendar, Drive, and more

Connect your users to Google Workspace services including Gmail, Google Calendar, Google Drive, and Google Sheets.

PropertyValue
Provider IDgoogle
CategoryProductivity
PKCESupported
Token refreshAutomatic (refresh token reused)
Access token lifetime~1 hour
Redirect URIShown in Developer Portal

Go to Google Cloud Console

Navigate to the Google Auth Platform Clients page and sign in with your Google account.

Create or select a project

Click the project dropdown at the top and select New Project. Give it a name (e.g., “My App - Alter Integration”) and click Create.

Enable APIs

Go to APIs & Services > Library and enable the APIs you need:

  • Gmail API - for email access
  • Google Calendar API - for calendar access
  • Google Drive API - for file access
  • Google Sheets API - for spreadsheet access

Open Clients page

Go to the Google Auth Platform > Clients page and click Create Client.

Configure consent screen (first time only)

If prompted, configure the OAuth consent screen:

  • User Type: External (unless you only need Google Workspace users)
  • App name: The application name
  • User support email: The operator’s support email
  • Authorized domains: The application’s domain
  • Developer contact: The operator’s contact email

Click through the remaining steps and Save.

Create OAuth client ID

  • Application type: Web application
  • Name: e.g., “Alter Vault Integration”
  • Authorized redirect URIs: Copy the Redirect URI from the Developer Portal
  • Click Create

Download credentials immediately

Download and securely store the Client ID and Client Secret from the dialog. The secret is only shown once at creation time.

The Client ID looks like: 123456789-abcdefg.apps.googleusercontent.com

Open the Developer Portal

Go to portal.alterauth.com and navigate to the application.

Add Google provider

Go to OAuth Providers > Add Provider > Google.

Enter credentials

  • Client ID: Paste your Google Client ID
  • Client Secret: Paste your Google Client Secret

Select scopes

Choose the scopes the application needs. See the Available Scopes section below.

Save

Click Save. The provider is now active and ready to use.

After a user connects via Alter Connect, use the returned grant_id to make API calls:

from alter_sdk import App, HttpMethod
async with App(
api_key="alter_key_...",
caller="my-agent",
) as alter_app:
# Use the grant_id returned by Alter Connect
response = await alter_app.request(
HttpMethod.GET,
"https://www.googleapis.com/calendar/v3/calendars/primary/events",
grant_id=grant_id,
query_params={"maxResults": "5"},
)
events = response.json()
print(f"Found {len(events.get('items', []))} events")
ScopeDescription
openidAuthenticate your identity with OpenID Connect
profileView your basic profile information
emailView your email address
ScopeDescription
https://www.googleapis.com/auth/gmail.readonlyView your email messages and settings
https://www.googleapis.com/auth/gmail.sendSend email on your behalf
https://www.googleapis.com/auth/gmail.composeManage drafts and send emails
https://www.googleapis.com/auth/gmail.modifyRead, compose, send, and permanently delete all your email from Gmail
ScopeDescription
https://www.googleapis.com/auth/calendar.readonlyView your calendars
https://www.googleapis.com/auth/calendar.eventsView and edit events on all your calendars
ScopeDescription
https://www.googleapis.com/auth/drive.readonlyView your Google Drive files
https://www.googleapis.com/auth/drive.fileView and manage Google Drive files that you have opened with this app
https://www.googleapis.com/auth/driveSee, edit, create, and delete all of your Google Drive files
Use CaseMethodURL
List calendar eventsGEThttps://www.googleapis.com/calendar/v3/calendars/primary/events
List Gmail messagesGEThttps://www.googleapis.com/gmail/v1/users/me/messages
Send emailPOSThttps://www.googleapis.com/gmail/v1/users/me/messages/send
List Drive filesGEThttps://www.googleapis.com/drive/v3/files
  • Google requires access_type=offline and prompt=consent to issue refresh tokens. Alter Vault handles this automatically.
  • If requesting profile or email scopes, the openid scope is automatically included.
  • Refresh tokens never expire unless the user revokes access or the token is inactive for 6 months.
  • Google enforces a limit of ~50 refresh tokens per user per app. Alter Vault’s connection deduplication prevents hitting this limit.
  • See the Google OAuth 2.0 overview and web-server flow guide for details.

Alter policy rules can target these attested operations and families for operation-level and parameter-aware controls.

Operation IDFamiliesMethodProvider path
gmail.users.messages.sendsendPOST/gmail/v1/users/{userId}/messages/send
gmail.users.drafts.sendsendPOST/gmail/v1/users/{userId}/drafts/send
gmail.users.messages.listreadGET/gmail/v1/users/{userId}/messages
gmail.users.messages.getreadGET/gmail/v1/users/{userId}/messages/{id}
gmail.users.messages.deletedeleteDELETE/gmail/v1/users/{userId}/messages/{id}
gmail.users.messages.trashwritePOST/gmail/v1/users/{userId}/messages/{id}/trash
gmail.users.drafts.createwritePOST/gmail/v1/users/{userId}/drafts
gmail.users.drafts.listreadGET/gmail/v1/users/{userId}/drafts
gmail.users.labels.listreadGET/gmail/v1/users/{userId}/labels
gmail.users.getProfilereadGET/gmail/v1/users/{userId}/profile

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.