Google Integration
Send emails via Gmail and read calendar events from your AI agents. 30-second setup.
Quick Start
What happens:
- Opens browser to Google OAuth consent screen
- You authorize Gmail Send + Calendar Read permissions
- Credentials saved to
.env(both local and global~/.co/keys.env) - Ready to use Gmail and Calendar tools immediately
That's it. Your agents can now send emails and read your calendar.
Prerequisites
Before running co auth google, you must authenticate with OpenOnion:
This creates your OPENONION_API_KEY which is required for Google OAuth to work.
What Gets Saved
After successful authentication, your .env file contains:
Security notes
- •Credentials are saved to both local
.envand~/.co/keys.env - •File permissions set to
0600(read/write for owner only) on Unix systems - •Access tokens expire, but refresh tokens allow automatic renewal
- •You can revoke access anytime via Google Account settings or the dashboard
Permissions Requested
When you run co auth google, we request these Google scopes:
| Scope | Purpose | What agents can do |
|---|---|---|
| gmail.send | Send emails on your behalf | Use send_email() tool to send emails |
| calendar.readonly | Read calendar events | Read your calendar to check availability |
| userinfo.email | Get your email address | Identify which Google account is connected |
Privacy First
We only request the minimum permissions needed. We cannot:
- ✕Read your inbox (use built-in
get_emails()for that) - ✕Delete or modify calendar events
- ✕Access your Google Drive or other services
Using Google OAuth in Agents
Once authenticated, your agents can use Google-powered tools:
Send Email via Gmail
Read Calendar Events
Complete Example: Scheduling Agent
Here's a full agent that can check your calendar and send meeting invites:
Troubleshooting
"Not authenticated with OpenOnion"
You need to run co auth first to get your OPENONION_API_KEY:
Authorization Timeout
If the browser window doesn't complete authorization within 5 minutes:
The command polls the backend every 2 seconds waiting for your authorization.
Credentials Not Working
Check if credentials are properly saved:
If credentials exist but don't work, re-authenticate:
