Repository navigation
fix(credentials): send a conflicting OAuth reconnect back with a reason instead of a 500 - #9391
Conversation
…on instead of a 500
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no new blocking issues remain. SummaryConflicting OAuth reconnects now return users to their starting page with a clear reason instead of a server error.
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
account.create.afteronce the callback has already answered, so the draft-hook guard's throw escaped the whole handleraccount.create.before, before the account row exists: the reconnect draft is discarded and the callback redirects back to the page the reconnect started from witherror=credential_account_conflictand a reason. Nothing is written, so the reconnected credential keeps its original account and the other credential keeps its own row and tokenserror_description; provider descriptions stay behind the generic messageCredentialAccountConflictError; the after-hook logs it at warn instead of failing the callbackstableExternalAccountId) between the stale-sibling migration and the new checkType of Change
Testing
oauth-reconnect-account-conflict.integration.tsdrives Better Auth's real/oauth2/link→/oauth2/callback/google-driveagainst Postgres with fixture provider endpoints: a conflicting reconnect redirects back with the reason and leaves both credentials, both account rows, and their tokens untouched; reconnecting with the credential's own identity still rebinds ituse-oauth-return.test.ts,draft-hooks.test.ts,draft-processor.test.ts,use-oauth-return-hooks.test.tsx; biome;check:comment-hygiene,check:file-names,check:test-patterns,check:utils,check:import-specifiers,check:unused-exportsChecklist
test-auditauthoring gate)