Repository navigation
feat(sources): Connect with Google for Google Calendar connections - #407
Merged
Merged
Conversation
A Google Calendar connection signs in to a Google account from a button: Lens saves the connection, opens Google's consent screen for read-only calendar access, and Google sends the browser back to Sources with the account connected and its calendars open. The OAuth client is the Google sign-in provider's, an earlier connection's, or one entered in the form, which shows the redirect URI to register. A connection whose sign-in stopped working gets "Connect Google account" on its row. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
…urces/{id}/google
Matches the Gmail source's route and rules so both types share one flow:
API tokens are refused (the consent comes back to the browser that
asked), the admin who started it must still be one when Google sends
them back, a type's SCOPES can depend on its settings, and a type names
the parameter that records the connected account (ACCOUNT).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
The journey failed now and then (on main too) with a 20 s timeout: an entity is in the graph once something links it twice, which takes import-file's episode as well, and a slow runner can still be reading it. The same wait as in #396, not counted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RrY2byt5BHVeBXJUyfwWpb
Owner
Author
|
Clicks and keystrokes per feature failed on I ported the fix from #397 ( Generated by Claude Code |
adeelahmad
marked this pull request as draft
October 15, 2026 11:52
adeelahmad
marked this pull request as ready for review
October 15, 2026 11:57
adeelahmad
pushed a commit
that referenced
this pull request
Oct 15, 2026
… its own Calendar's Connect with Google (#407) brings the browser consent for Google sources; Gmail joins it in the next pull request. This one keeps the source: a connected account's token, or a Workspace service account, read through the Gmail API or over IMAP. The wording says to connect the Google account again, as Calendar's does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q
20 of 22 tasks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
This was referenced Oct 15, 2026
adeelahmad
added a commit
that referenced
this pull request
Oct 15, 2026
* feat(sources): Gmail and Google Workspace as an email sensor A new "gmail" source reads a Gmail or Google Workspace mailbox, by the Gmail API (read only) or by IMAP with XOAUTH2. It signs in as a person with the Google client from Settings › Sign-in (OAuth, refresh token sealed on the source), or as a Workspace service account with domain-wide delegation. Watches follow Gmail's history ids, so a first scan of a big mailbox reads nothing and later scans read only new mail. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q * fix(sources): bring Google sign-in back to Sources Sources live at /sources; /sensors/{id} is a different thing with its own ids, so a Gmail source signed in there landed on the wrong page. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q * test(clicks): graph-merge waits for the imports' jobs to finish Ported from #397: the journey fails now and then on main too with a 20 s timeout while a slow runner is still reading import-file's episode. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q * refactor(sources): Gmail signs in through the shared Google flow, not its own Calendar's Connect with Google (#407) brings the browser consent for Google sources; Gmail joins it in the next pull request. This one keeps the source: a connected account's token, or a Workspace service account, read through the Gmail API or over IMAP. The wording says to connect the Google account again, as Calendar's does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q --------- Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
20 of 22 tasks
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
20 of 22 tasks
20 of 22 tasks
adeelahmad
added a commit
that referenced
this pull request
Oct 15, 2026
… with Google (#420) * feat(sources): connect Gmail from the connection dialog, with Connect with Google Add connection › Gmail connects the account through the same consent flow as Google Calendar (#407): Google asks to read mail (all of Gmail for IMAP), the account's address becomes the source's user, and its labels open. A Workspace service account takes its key and the address it acts for, and says which client id and scope an admin must allow. A Gmail row whose sign-in stopped working offers Connect Google account. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q * chore(api): regenerate the OpenAPI client for the Google connect route's wording Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzqrXPCMR7aJYyLPqmx41Q --------- Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
Merged
16 of 22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Before: a Google Calendar connection could sign in as a Google account only by pasting an OAuth client's authorized user JSON made with gcloud.
After: the Google account option has a Connect with Google button. It saves the connection (creating it first if it is new) and opens Google's consent screen for read-only calendar access. Google then sends the browser back to Sources, where the account is connected, its address shows on the connection ("as mara@…"), and its calendars open so you can pick one to watch. If connecting fails, a red toast appears and the connection opens again.
The OAuth client is the Google sign-in provider's (Settings › Sign-in) when there is one, otherwise an earlier Google connection's. If there is neither, the form asks for a client ID and secret and shows the redirect URI to register, the same address Google sign-in uses. A connection whose Google sign-in stopped working shows Connect Google account on its row, which goes straight to Google. Pasting the JSON still works, folded under "Or paste an authorized user JSON".
How:
/api/v1/auth/external/google/callback) withmode: source.google_auth.connect_start/connect_finishdo PKCE S256,access_type=offlineandprompt=consent.GET /api/v1/sources/google-clientsays which client would be used and gives the redirect URI.POST /api/v1/sources/{id}/google(optional body: client ID and secret) returns the consent address.token.source.google_connect.SCOPES(a tuple, orSCOPES(params)) andACCOUNT, the parameter that records the address (defaultaccount).Motivation and Context
Adeel asked for Google Calendar as a sensor, by OAuth and by service account. #399 shipped both sign-ins; this PR turns the OAuth one into a button instead of a gcloud command.
Types of changes
!in the title)Checklist:
test_connecting_a_google_account_in_the_browserruns against the fake Google's consent and code exchange, including the API-token 403 and the admin re-check.test_scopes_by_type.__tests__/add-connection.test.tsx"connecting a Google account".__tests__/sources-model.test.ts.docs/accordingly (docs/processing.md,docs/authentication.md).## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
tokenthrough the API. The consent step itself has to be a person's in a browser, so the route refuses API tokens and says why.google.tokenrow in the activity ledger.accountparameter defaults to empty.make openapi).🤖 Generated with Claude Code
https://claude.ai/code/session_01CGVfwJfXV4MiUhSyusia64
Generated by Claude Code