Skip to content

fix(cursor): enable multi-account OAuth by extracting JWT identity - #67

Merged
lidge-jun merged 1 commit into
lidge-jun:previewfrom
Wibias:fix/cursor-multi-account-oauth
Jul 9, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:previewfrom
Wibias:fix/cursor-multi-account-oauth

Conversation

@Wibias

@Wibias Wibias commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extract stable Cursor account identity from JWT sub (and email when present) during login and token refresh, so the multiauth store can append distinct accounts instead of always replacing the active slot.
  • Fix the Providers UI add-account polling loop to treat a completed OAuth flow (done: true) as success, not only when the account count grows — covers same-account re-login.

Problem

Adding a second Cursor account showed "Waiting for browser…" forever even after Cursor returned "All set!". OAuth completed (done: true) but accounts.length stayed at 1 because Cursor credentials had no persisted identity.

Test plan

  • bun test tests/cursor-oauth.test.ts tests/oauth-store-multi.test.ts
  • Add a second Cursor account via Web UI → dialog closes, both accounts listed
  • Switch between Cursor accounts in the provider card dropdown
  • Re-login the same Cursor account via "Add account" → completes without hanging

Cursor tokens carry a stable sub claim but login never persisted it, so
add-account flows replaced the active slot and the GUI polled forever.
Extract accountId (and email when present) from Cursor JWTs and treat
add-account completion as done when the OAuth flow finishes.
@lidge-jun

Copy link
Copy Markdown
Owner

Reviewed against current dev (post-260709 catalog refresh). This is a clean, well-scoped fix:

  • Extracting a stable identity from the JWT sub/email in credentialsFromCursorTokens is the right way to unlock multiauth append semantics for Cursor — and consolidating getTokenExpiry onto the same decoder is a nice cleanup.
  • The Providers UI polling fix (done: true && !error as an add-account completion signal) correctly covers the same-account re-login case that previously hung on accounts.length.
  • git apply --check passes against dev with zero file intersection with our recent commits, and tests are included.

Decision: accepting. I'll merge this into preview and cherry-pick it onto dev so it ships with the current integration branch. Thanks for the thorough test plan!

@lidge-jun
lidge-jun merged commit a5dfa1c into lidge-jun:preview Jul 9, 2026
@lidge-jun

Copy link
Copy Markdown
Owner

Landed: merged into preview and cherry-picked onto dev as 46ac27f (authorship preserved). Gates after landing: tsc --noEmit clean, full bun test 1658 pass / 0 fail. Thanks again!

@Wibias
Wibias deleted the fix/cursor-multi-account-oauth branch July 13, 2026 19:19
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…oauth

fix(cursor): enable multi-account OAuth by extracting JWT identity
@lidge-jun lidge-jun mentioned this pull request Oct 10, 2026
3 tasks done
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.

2 participants