Skip to content

fix(web): dedicated Google re-auth page + PR #39 review follow-ups - #40

Open
ajinkyasraj wants to merge 1 commit into
mainfrom
fix/google-reauth-ux-and-review
Open

fix(web): dedicated Google re-auth page + PR #39 review follow-ups#40
ajinkyasraj wants to merge 1 commit into
mainfrom
fix/google-reauth-ux-and-review

Conversation

@ajinkyasraj

Copy link
Copy Markdown
Collaborator

Follow-up to #39 (now merged): fixes the Google Re-authenticate UX and addresses the Copilot review comments.

The re-auth UX problem

On a Google connection, "Re-authenticate" was a <details> disclosure inside a cramped, right-aligned whitespace-nowrap table cell. Clicking it only expanded a form rather than doing anything — so it read as broken, and its placement/purpose were unclear.

Fix: a proper re-auth page (mirrors the Edit page):

  • New GET /connections/{id}/reauthconnection_reauth.html: one clear primary "Re-authenticate with Google" button (uses the connection's stored client), plus an optional "use a different OAuth client" disclosure for same-account client migration. Shows the bound account so the operator knows what they're re-authing.
  • The connections table now shows a plain Re-authenticate link (amber for reauth_required, subtle for active) that navigates to the page — no more form-in-<details>, no CSRF/JS-injection edge. reauth_required connections now reach the same page too.

Review follow-ups (Copilot on #39)

  • Both-or-neither validation (add + reauth): a google_client_id with no client_secret builds a config the gmail connector can't refresh (it needs both), so the token would silently die at expiry. Now a 400.
  • writeConnectionError on reauth instead of the hand-rolled ErrKeyringNotLoaded-only block — so ErrKeyringRotating is handled (503 + Retry-After), no drift.
  • Corrected reauth-migration wording (UI + oauth-pkce.md): re-auth requires signing in as the same account, so migration is to a different client for the same account (e.g. a new GCP project in the same org) — not cross-org. A different org's Internal client won't admit the account (org_internal); cross-org = delete + re-add.

Tests

go build/vet, gofmt -l clean; go test ./internal/web/ green, including new cases: reauth page renders (shows bound account); default reauth redirects to Google using the stored client; half-specified client rejected (400) on both add and reauth.

🤖 Generated with Claude Code

The inline "Re-authenticate" control on a Google connection was a <details>
disclosure inside a cramped, right-aligned table cell: clicking it only expanded
a form instead of doing anything, so it read as broken, and its placement/purpose
were unclear. Replace it with a proper page (mirrors the Edit page).

- New GET /connections/{id}/reauth → connection_reauth.html: a clear single
  primary "Re-authenticate with Google" button (uses the connection's stored
  client), plus an optional "use a different OAuth client" disclosure for
  same-account client migration. The table now shows a plain Re-authenticate
  link (reauth_required = amber, active = subtle) that navigates to it — no more
  form-in-<details>. reauth_required connections reach the same page (Copilot).

Review follow-ups from PR #39:
- Both-or-neither validation on add + reauth: a google_client_id without a
  client_secret builds a non-refreshing config (gmail needs both), so the token
  would die at expiry. Reject the half-specified case with 400.
- Reauth uses writeConnectionError for keyring errors (covers ErrKeyringRotating
  with Retry-After), instead of the hand-rolled ErrKeyringNotLoaded-only block.
- Correct the reauth-migration wording (UI + oauth-pkce.md): re-auth requires
  the same account, so migration is to a different client for the SAME account
  (e.g. a new GCP project in the same org), NOT cross-org. Cross-org = delete +
  re-add.
- Tests: reauth page renders; default reauth uses the stored client; half-
  specified client rejected on both add and reauth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant