[PR #8917] [CLOSED] fix(auth): use provider-specific lookup in link-social callbak #16543

Closed
opened 2026-04-13 10:34:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8917
Author: @SandipGyawali
Created: 4/2/2026
Status: Closed

Base: mainHead: main


📝 Commits (3)

  • 44114e2 fix(auth): use provider-specific lookup in link-social callbak
  • c019894 Merge branch 'main' into main
  • fbcfc9c Merge branch 'main' into main

📊 Changes

1 file changed (+5 additions, -3 deletions)

View changed files

📝 packages/better-auth/src/api/routes/callback.ts (+5 -3)

📄 Description

  • 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 fbcfc9c728. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8917 **Author:** [@SandipGyawali](https://github.com/SandipGyawali) **Created:** 4/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`44114e2`](https://github.com/better-auth/better-auth/commit/44114e2838fce6b2e227e51ebcb1ecfc6bec859c) fix(auth): use provider-specific lookup in link-social callbak - [`c019894`](https://github.com/better-auth/better-auth/commit/c019894d56b736eb92daca45daa1a267ac6eef4a) Merge branch 'main' into main - [`fbcfc9c`](https://github.com/better-auth/better-auth/commit/fbcfc9c728cc62cffe72ec38e92d87010b8303e0) Merge branch 'main' into main ### 📊 Changes **1 file changed** (+5 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/callback.ts` (+5 -3) </details> ### 📄 Description - replaced findAccount() with findAccountByProviderId() in Oauth - prevents two providers return the same external accountiD Issue: #8906 <!-- This is an auto-generated description by cubic. --> --- ## 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. <sup>Written for commit fbcfc9c728cc62cffe72ec38e92d87010b8303e0. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:34:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16543