[PR #3839] [MERGED] fix: avoid general oauth flow duplicate user #13287

Closed
opened 2026-04-13 08:51:21 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3839
Author: @himself65
Created: 8/6/2025
Status: Merged
Merged: 8/20/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/08/06/oauth


📝 Commits (8)

📊 Changes

3 files changed (+421 additions, -80 deletions)

View changed files

📝 packages/better-auth/src/oauth2/types.ts (+9 -7)
📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+366 -31)
📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+46 -42)

📄 Description

Fixes: https://github.com/better-auth/better-auth/pull/3816#issuecomment-3161748770,
Upstream: https://github.com/better-auth/better-auth/issues/3814, https://github.com/better-auth/better-auth/issues/2062

Update the general OAuth plugin to support numbers as user.id and reduce any type in the codebaes


Summary by cubic

Updated the generic OAuth plugin to support numeric user IDs and prevent duplicate user accounts when OAuth providers return numbers as IDs.

  • Bug Fixes
    • Ensured all user and account IDs are handled as strings to avoid duplicate accounts.
    • Added tests for numeric user IDs in different OAuth flows.

🔄 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/3839 **Author:** [@himself65](https://github.com/himself65) **Created:** 8/6/2025 **Status:** ✅ Merged **Merged:** 8/20/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/08/06/oauth` --- ### 📝 Commits (8) - [`3af736b`](https://github.com/better-auth/better-auth/commit/3af736b59bea5c645985268fee72bcc49f4fd272) fix: avoid general oauth flow duplicate user - [`9442aa8`](https://github.com/better-auth/better-auth/commit/9442aa88ad24c4cf5806b36c91a696248774b292) fix: parallel issue - [`4cb9ca6`](https://github.com/better-auth/better-auth/commit/4cb9ca61f74bc38686cc066d6e9528d82529bc66) fixup! fix: avoid general oauth flow duplicate user - [`4784f92`](https://github.com/better-auth/better-auth/commit/4784f92289a8124d91ffb45aec449ab88fd115ba) test: fix - [`d898647`](https://github.com/better-auth/better-auth/commit/d8986475c3fb5641c9bec4c912271765337b49b4) fix schema - [`bfea321`](https://github.com/better-auth/better-auth/commit/bfea321ce7942a4a15d57dda22cc0c32f5eced34) fix: correct user type - [`323a6af`](https://github.com/better-auth/better-auth/commit/323a6af09c15498712d6922e684bb82179ff8060) fix: add more test case - [`a54c435`](https://github.com/better-auth/better-auth/commit/a54c435c67b2f371a02d975f91491b2718f4b563) test: fix remove console.log ### 📊 Changes **3 files changed** (+421 additions, -80 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/oauth2/types.ts` (+9 -7) 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+366 -31) 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+46 -42) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/pull/3816#issuecomment-3161748770, Upstream: https://github.com/better-auth/better-auth/issues/3814, https://github.com/better-auth/better-auth/issues/2062 Update the general OAuth plugin to support numbers as user.id and reduce any type in the codebaes <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated the generic OAuth plugin to support numeric user IDs and prevent duplicate user accounts when OAuth providers return numbers as IDs. - **Bug Fixes** - Ensured all user and account IDs are handled as strings to avoid duplicate accounts. - Added tests for numeric user IDs in different OAuth flows. <!-- 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 08:51:21 -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#13287