gmail-oauthSet up Gmail API access via gog CLI with manual OAuth flow. Use when setting up Gmail integration, renewing expired OAuth tokens, or troubleshooting Gmail authentication on headless servers.
Install via ClawdBot CLI:
clawdbot install kai-jar/gmail-oauthHeadless-friendly OAuth flow for Gmail API access using gog CLI.
gog CLI installed (brew install steipete/tap/gogcli)gmail.modify (or others as needed)gog auth credentials /path/to/client_secret.json
gog auth keyring file # Use file-based keyring for headless
export GOG_KEYRING_PASSWORD="your-password" # Add to .bashrc
Run scripts/gmail-auth.sh interactively, or:
# Generate URL
scripts/gmail-auth.sh --url
# User opens URL, approves, copies code from localhost redirect
# Exchange code (do this quickly - codes expire in minutes!)
scripts/gmail-auth.sh --exchange CODE EMAIL
gog gmail search 'is:unread' --max 5 --account you@gmail.com
Cause: App is in "Testing" mode and the Gmail account isn't a test user.
Solutions (choose one):
This is normal for personal apps. Click:
Safe to proceed since you own the app.
Cause: App is in "Testing" mode.
Fix: Publish the app (see above). Published apps get permanent refresh tokens.
Causes:
Fix: Generate a fresh auth URL and complete the flow quickly. Paste the code immediately after getting it.
Cause: The redirect URI in the token exchange doesn't match what was used in the auth URL.
Fix: This script uses http://localhost. Make sure both the auth URL and exchange use the same redirect URI.
Cause: Browser trying to connect to localhost which doesn't exist on phone.
Fix:
http://localhost/?code=4/0ABC...Cause: Too many OAuth scopes requested.
Fix: Use minimal scopes. gmail.modify alone is usually sufficient and shows just one permission.
Cause: Signed into wrong Google account.
Fix: Check which account owns the project:
Cause: Google deprecated urn:ietf:wg:oauth:2.0:oob for OAuth clients created after 2022.
Fix: Use http://localhost redirect instead (this script's default). After approval, browser redirects to localhost with code in URL.
| Scope | Access |
|-------|--------|
| gmail.modify | Read, send, delete, manage labels (recommended) |
| gmail.readonly | Read only |
| gmail.send | Send only |
| gmail.compose | Create drafts, send |
scripts/gmail-auth.sh — Interactive auth helpergmail.modify covers most use casesGenerated Feb 24, 2026
A customer service team uses this skill to set up Gmail API access for an AI agent that automatically categorizes and responds to customer inquiries. It enables the agent to read incoming emails, send templated replies, and manage labels for tracking issues, improving response times and organization.
A marketing agency integrates this skill to automate email campaign tracking and follow-ups. The AI agent monitors Gmail for campaign responses, sends personalized follow-up emails, and compiles reports on engagement metrics, streamlining outreach efforts and reducing manual workload.
An individual uses this skill to set up a personal AI assistant that manages email tasks, such as filtering spam, scheduling reminders from emails, and drafting replies. It helps organize inboxes and save time on daily email management for busy professionals.
A DevOps team deploys this skill on a headless server to monitor system alerts sent via Gmail. The AI agent reads emails for error notifications, triggers automated responses or alerts, and logs issues, ensuring reliable system oversight without manual intervention.
A company offers a subscription-based service that uses this skill to provide automated email management features, such as sorting, responding, and analytics. Revenue is generated through monthly or annual user fees, with tiers based on email volume and advanced features.
A consulting firm uses this skill to help clients set up and customize Gmail API integrations for their specific workflows. Revenue comes from project-based fees for implementation, training, and ongoing support, targeting businesses needing tailored email automation solutions.
A developer creates a free app with basic email management features using this skill, then monetizes through premium upgrades like advanced analytics, team collaboration tools, or priority support. Revenue is generated from in-app purchases or premium subscriptions.
💬 Integration Tip
Ensure the Google Cloud project is published to avoid token expiration issues, and use minimal scopes like gmail.modify to simplify the OAuth flow and reduce user permission prompts.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Read and send email via IMAP/SMTP. Check for new/unread messages, fetch content, search mailboxes, mark as read/unread, and send emails with attachments. Works with any IMAP/SMTP server including Gmail, Outlook, 163.com, vip.163.com, 126.com, vip.126.com, 188.com, and vip.188.com.
Gmail API integration with managed OAuth. Read, send, and manage emails, threads, labels, and drafts. Use this skill when users want to interact with Gmail. For other third party apps, use the api-gateway skill (https://clawhub.ai/byungkyu/api-gateway).
Automatically logs into email accounts (Gmail, Outlook, QQ Mail, etc.) and generates daily email summaries. Use when the user wants to get a summary of their emails, check important messages, or create daily email digests.
Fetch content from Feishu (Lark) Wiki, Docs, Sheets, and Bitable. Automatically resolves Wiki URLs to real entities and converts content to Markdown.
Manage Feishu (Lark) calendars by listing, searching, checking schedules, syncing events, and marking tasks with automated date extraction.