Skip to content

fix(auth): use provider-specific lookup in link-social callbak#8917

Closed
SandipGyawali wants to merge 3 commits into
better-auth:mainfrom
SandipGyawali:main
Closed

fix(auth): use provider-specific lookup in link-social callbak#8917
SandipGyawali wants to merge 3 commits into
better-auth:mainfrom
SandipGyawali:main

Conversation

@SandipGyawali
Copy link
Copy Markdown

@SandipGyawali SandipGyawali commented Apr 2, 2026

  • replaced findAccount() with findAccountByProviderId() in Oauth
  • prevents two providers return the same external accountiD

Issue: #8906


Summary by cubic

Switch the OAuth link-social callback in better-auth to use provider-scoped account lookup to prevent ID collisions across providers. Replace findAccount(...) with findAccountByProviderId(id, provider.id) to ensure the correct user is linked; addresses #8906.

Written for commit fbcfc9c. Summary will update on new commits.

@SandipGyawali SandipGyawali requested a review from Bekacru as a code owner April 2, 2026 13:56
@vercel vercel Bot temporarily deployed to Preview – better-auth April 2, 2026 13:56 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
better-auth Skipped Skipped Apr 2, 2026 1:56pm

Request Review

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 2, 2026

@SandipGyawali is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 2, 2026

Open in StackBlitz

@better-auth/api-key

npm i https://pkg.pr.new/@better-auth/api-key@8917

better-auth

npm i https://pkg.pr.new/better-auth@8917

auth

npm i https://pkg.pr.new/auth@8917

@better-auth/core

npm i https://pkg.pr.new/@better-auth/core@8917

@better-auth/drizzle-adapter

npm i https://pkg.pr.new/@better-auth/drizzle-adapter@8917

@better-auth/electron

npm i https://pkg.pr.new/@better-auth/electron@8917

@better-auth/expo

npm i https://pkg.pr.new/@better-auth/expo@8917

@better-auth/i18n

npm i https://pkg.pr.new/@better-auth/i18n@8917

@better-auth/kysely-adapter

npm i https://pkg.pr.new/@better-auth/kysely-adapter@8917

@better-auth/memory-adapter

npm i https://pkg.pr.new/@better-auth/memory-adapter@8917

@better-auth/mongo-adapter

npm i https://pkg.pr.new/@better-auth/mongo-adapter@8917

@better-auth/oauth-provider

npm i https://pkg.pr.new/@better-auth/oauth-provider@8917

@better-auth/passkey

npm i https://pkg.pr.new/@better-auth/passkey@8917

@better-auth/prisma-adapter

npm i https://pkg.pr.new/@better-auth/prisma-adapter@8917

@better-auth/redis-storage

npm i https://pkg.pr.new/@better-auth/redis-storage@8917

@better-auth/scim

npm i https://pkg.pr.new/@better-auth/scim@8917

@better-auth/sso

npm i https://pkg.pr.new/@better-auth/sso@8917

@better-auth/stripe

npm i https://pkg.pr.new/@better-auth/stripe@8917

@better-auth/telemetry

npm i https://pkg.pr.new/@better-auth/telemetry@8917

@better-auth/test-utils

npm i https://pkg.pr.new/@better-auth/test-utils@8917

commit: fbcfc9c

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown
Member

@bytaesu bytaesu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add regression test code?

- replaced findAccount() with findAccountByProviderId() in Oauth
- prevents two providers return the same external accountiD
@gustavovalverde gustavovalverde requested a review from a team as a code owner April 5, 2026 17:46
@github-actions github-actions Bot added the core Core infra, API routes, session, cookies, client SDK label Apr 5, 2026
@gustavovalverde
Copy link
Copy Markdown
Contributor

Solved in #8983

@better-release
Copy link
Copy Markdown
Contributor

This issue has been locked as it was closed more than 7 days ago. If you're experiencing a similar problem or you have additional context, please open a new issue and reference this one.

@better-release better-release Bot added the locked Locked conversations after being closed for 7 days label Apr 17, 2026
@better-release better-release Bot locked as resolved and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

core Core infra, API routes, session, cookies, client SDK locked Locked conversations after being closed for 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants