Gmail configuration
Package:sanvex/gmail · Driver id: gmail · Auth: OAuth2 only
Tokens are stored in encrypted sv_accounts. The Gmail driver reads access_token from there at runtime.
Google Cloud
- Google Cloud Console — create or select a project.
- APIs & Services → Library — enable Gmail API.
- OAuth consent screen — configure (use External if end users connect their own Gmail).
- Credentials → OAuth client ID — type Web application.
- Authorized redirect URIs — must match
GMAIL_REDIRECT_URI(default{APP_URL}/sanvex/gmail/callback).
.env.
Environment variables
config/sanvex.php (optional)
Set the variables in .env above — that is enough for most apps.
To override defaults in published config:
GMAIL_CLIENT_ID is set.
Google OAuth scopes
The built-in authorize URL requests:
For send or delete, customize
GmailDriver::oauthConfig() scopes in your app or fork.
Authorize follows Google’s web server flow: access_type=offline, prompt=consent. Token exchange is application/x-www-form-urlencoded with client_id and client_secret in the POST body.
Built-in Sanvex OAuth routes
Yes — registered whenGMAIL_CLIENT_ID is set (via OAuthRoutes::registerIfConfigured).
Default callback uses global owner scope (same as Notion).
Token exchange uses form body credentials (Google), not HTTP Basic Auth.
Stored credentials (sv_accounts)
Set
SANVEX_KEK in production so tokens are encrypted at rest (Installation).
What the driver reads
Next: Setup · Resources
