Content

We Tried Connecting Gmail to a Self-Hosted Agent Without a Google Cloud Project. Here's What That Actually Takes.

Google's own quick-start for Gmail access assumes you're willing to create a Cloud project, configure a consent screen, and manage OAuth credentials yourself. We tried skipping all of that. Here's what it actually took.

IntegrationsNov 20, 2026

Key takeaways

  • -Google's standard path to Gmail API access assumes a Cloud project, a configured consent screen, and self-managed OAuth credentials.
  • -That path is reasonable for a company building a product around Gmail; it's heavy for a side agent that just needs to read and send mail.
  • -The actual friction isn't the Gmail API itself — it's the one-time setup tax Google's console imposes before the first API call.
  • -A shared, already-verified OAuth app removes that setup tax: connect the account, skip creating a project.
  • -Swytchcode provides exactly that shared app, so connecting Gmail is an authorization click, not a Cloud Console session.

Google's own path to Gmail access assumes you're building a company around it. A Cloud project, a configured OAuth consent screen, a verification process if you want to go past the testing-mode user cap. We wanted an agent that could read and send mail. We did not want to become a Google Cloud administrator to get there.

TL;DR

  • Google's standard Gmail API path requires creating a Cloud project and configuring an OAuth consent screen before the first API call.
  • That setup tax is reasonable for a product built around Gmail; it's disproportionate for an agent that just needs to read and send a handful of emails.
  • The friction isn't in the Gmail API's design — it's entirely in the one-time console configuration Google requires before any call succeeds.
  • A shared, already-verified OAuth app removes that tax: you authorize an account against an app that already exists, instead of creating your own.
  • Swytchcode provides exactly that shared app, so connecting Gmail becomes an authorization click, not a Cloud Console session.

The quick-start that wasn't quick

We wanted a self-hosted agent to check a Gmail inbox and send replies. Google's Gmail API quick-start reads simply enough: enable the API, create credentials, authorize, call. In practice, step one alone — "create credentials" — meant creating a Google Cloud project, navigating to the API & Services console, configuring an OAuth consent screen with a name and support email, choosing between internal and external user types, and, for anything beyond a handful of test users, starting a verification process that can take days. We hadn't written a line of agent code yet, and we'd already spent the better part of an afternoon in a console that had nothing to do with our actual task.

Why Google's path looks like this, and who it's actually for

This process makes complete sense for a company building a product that will connect thousands of Gmail accounts — the consent screen, the verification, the app identity are all things a real product needs to present to its own users. It makes much less sense for a single developer connecting their own inbox, or a small team connecting a handful of accounts to an internal agent, because they're being asked to stand up the same app-identity infrastructure a public product would need, for a use case that will never have external users at all.

The actual bottleneck: a one-time console tax, not the API itself

Once credentials exist, the Gmail API itself is straightforward — request a scope, get a token, read or send mail. Every bit of friction we hit was in the one-time setup before that point: the project creation, the consent screen fields, the user-type decision, the verification gate. None of that is a Gmail API problem. It's a "you need your own verified app identity" problem, and that requirement exists independent of how simple the actual mail operations are underneath it.

Skipping the console entirely: a shared, already-verified app

The fix isn't a trick to bypass Google's requirements — it's not needing your own app identity at all. A shared OAuth app, already created and already verified by someone else, lets you connect your Gmail account by authorizing that existing app rather than building a new one. You still go through Google's real consent screen and grant real, scoped permission. What disappears is the part where you had to create and verify the app yourself first.

Three fixes, and how Swytchcode enforces each one

  1. Provide a pre-verified shared OAuth app for Gmail. Connecting an account means authorizing against Swytchcode's existing, already-verified app, not registering a new one in your own Cloud console.
  2. Scope the connection to exactly what the agent needs. Read-only access and send access are separate scopes, granted explicitly, so the agent only gets what the authorization actually covered.
  3. Handle token storage and refresh the same way every other connection does. Once connected, Gmail access behaves like any other capability at the execution layer — the agent calls it, the credential lifecycle is handled underneath.

To see a Gmail call made through an already-connected account, with no app registration in sight:

swytchcode exec gmail.messages.send --explain   # see what would run, no HTTP call
swytchcode exec gmail.messages.send --dry-run   # see the planned request
swytchcode exec gmail.messages.send --demo      # simulated run, no credentials

Full scope and connection details are in the Swytchcode docs. If you're hitting the same console-tax problem for a different provider, the companion post on why OAuth isn't simple for self-hosted agents covers the general pattern Gmail was just one example of.

FAQ

Is using a shared OAuth app less secure than creating my own? The security model is the same consent and scoping Google enforces either way — you still see and approve exactly what's being requested. What changes is who owns and verifies the app identity, not what permissions your account actually grants.

Can I revoke access the same way I would with my own app? Yes — Google's own account permissions page shows the app you authorized and lets you revoke it at any time, independent of who created the app.

Does this work for Google Workspace accounts, not just personal Gmail? Workspace admins can have their own policies on third-party app access, so a Workspace account may need admin approval before the same connection flow completes.

What if I eventually do need my own verified app, for a public product? That's exactly the case Google's standard process is built for, and it remains the right path once you're building something with external users of your own rather than connecting your own accounts.

Try it

If a Google Cloud console session is the only thing standing between your agent and a connected Gmail account, that's the exact afternoon this skips.

Install the Swytchcode CLI, read the Gmail connection docs, and connect an inbox without opening the Cloud Console once. One command, no SDK setup.

Related reading: The Real Reason 'Just Add OAuth' Isn't Simple for a Self-Hosted Agent and Ask Your Agent for Any App.

More content

Ready to make your agent's tool calls reliable?

Give this prompt to your agent and get started.