Finish connecting a Google Workspace mailbox
Exchanges the OAuth code and creates (or reconnects) the mailbox.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Response
Successful Response
Whether the mailbox's grant currently authenticates.
connected, disconnected Which email provider a mailbox connects through.
Phase 1 ships Google Workspace only; every provider is implemented behind
providers.EmailProviderBase so Office 365 and IMAP/SMTP can be added
later without touching callers.
GOOGLE_WORKSPACE holds a per-mailbox OAuth grant (consent screen,
refresh token). GOOGLE_WORKSPACE_DWD holds no grant at all: tokens are
minted on demand via domain-wide delegation as the platform service
account, so its rows carry an empty refresh_token forever — the path
imported fleets (e.g. InboxKit) connect through.
google_workspace, google_workspace_dwd DSNs / accepted sends, lifetime.
MBX-04: when a read+send verification last succeeded.
Genuine replies / accepted sends, lifetime.