OAuth client and consent
A Cloud project, an OAuth client and a consent screen. Ask for offline access so a refresh token comes back. Users can grant scopes one by one. OAuth 2.0
Google Workspace and Gmail stay on Google’s API. Workwae runs the history sync, the Pub/Sub watch and the send, and notifies your app with webhooks.
These are Google’s rules, from Google’s own docs. Workwae does not remove consent, verification or quota.
A Cloud project, an OAuth client and a consent screen. Ask for offline access so a refresh token comes back. Users can grant scopes one by one. OAuth 2.0
Gmail scopes are restricted. A production app needs Google verification and a CASA assessment. Apps left in Testing get refresh tokens that expire in 7 days. Gmail scopes
users.watch publishes to a topic in the same Cloud project as the OAuth client. A watch lasts at most 7 days. Gmail push
Methods spend quota units per user, and the project has a daily cap. History reads and sends both count. Gmail quota
Mail sync replays history.list. When Google says the history id is too old, that mailbox is read again and diffed against the index.
Platform-app accounts watch Workwae’s Pub/Sub topic. A tenant app watches a topic in that app’s project. Watches renew daily. If Google refuses the watch, the account is polled.
Register your OAuth client, or use Workwae’s. Ours has not completed CASA. The platform app asks for gmail.modify, not the full mail scope, so permanent delete is refused for those accounts; trash works. Gmail over IMAP needs your own app.
Calendar sync uses a sync token and watch channels on calendars you can write (Google Calendar). Contacts use the People API and are polled; Google has no contact push. Both need their own scopes on the grant.
Hosted connect returns a URL. After the user consents, send through the outbox. The shapes match the TypeScript (@workwae/sdk) and Python (workwae) SDKs.
const session = await workwae.connectSessions.create({
redirectUri: "https://app.example.com/mail/connected",
providers: ["google"],
externalRef: user.id,
options: { calendarEnabled: true, contactsEnabled: true },
});
const send = await workwae.outbox.create({
accountId,
to: [{ name: "Grace Hopper", address: "grace@example.org" }],
subject: "Invoice 1001",
text: "Hi Grace, your invoice is attached.",
});session = workwae.connect_sessions.create(
redirect_uri="https://app.example.com/mail/connected",
providers=["google"],
external_ref=user.id,
options={"calendar_enabled": True, "contacts_enabled": True},
)
send = workwae.outbox.create(
account_id=account_id,
to=[{"name": "Grace Hopper", "address": "grace@example.org"}],
subject="Invoice 1001",
text="Hi Grace, your invoice is attached.",
)They consent on Google’s screen, to Workwae’s app or to the Google app you registered. Workwae’s app has not completed CASA. Restricted Gmail scopes on your app still need your own verification.
Not for Workwae’s app. For your own Google app, the watch topic has to live in that app’s Cloud project, with a push subscription Workwae can receive. Without it, those accounts are polled.
Yes, when your own Google app issued them. Register that client and call accounts.create with the refresh token. Google caps refresh tokens at 100 per account per client id.
No. Gmail and Calendar use the same hosts for every Workspace customer. Microsoft government clouds are a Microsoft concern.
Tell us how many Workspace accounts you need to sync.