[PR #6851] [CLOSED] fix: disable account linking by default #23822

Closed
opened 2026-04-15 22:00:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6851
Author: @bytaesu
Created: 12/18/2025
Status: Closed

Base: canaryHead: 2025-12-18/fix/account-linking-default-disabled


📝 Commits (2)

  • 9d3852b fix: disable account linking by default
  • 3c79387 test: update test cases for accountLinking default false

📊 Changes

10 files changed (+109 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/api/routes/account.test.ts (+1 -0)
📝 packages/better-auth/src/api/routes/account.ts (+1 -1)
📝 packages/better-auth/src/api/routes/callback.ts (+1 -1)
📝 packages/better-auth/src/oauth2/link-account.test.ts (+86 -0)
📝 packages/better-auth/src/oauth2/link-account.ts (+1 -1)
📝 packages/better-auth/src/plugins/admin/admin.test.ts (+5 -0)
📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+5 -0)
📝 packages/better-auth/src/plugins/mcp/mcp.test.ts (+3 -0)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+5 -0)
📝 packages/core/src/types/init-options.ts (+1 -1)

📄 Description

The documentation states default: false, but the internal logic was implemented as default: true. These should be aligned. I think account linking should only work when explicitly enabled, so I’m opening this PR.

Closes https://github.com/better-auth/better-auth/issues/6848

docs

Summary by cubic

Disable account linking by default to match the docs and prevent unintended linking. Linking now only happens when explicitly enabled.

  • Bug Fixes

    • Require account.accountLinking.enabled === true in account, callback, and OAuth linking flows.
    • Update option docs/types: default is now false.
    • Adjust tests to set enabled: true where needed; add coverage ensuring default-disabled behavior (returns account_not_linked).
  • Migration

    • If you use account linking, set account.accountLinking.enabled: true in your config.

Written for commit 3c79387c98. Summary will update automatically 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/6851 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 12/18/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `2025-12-18/fix/account-linking-default-disabled` --- ### 📝 Commits (2) - [`9d3852b`](https://github.com/better-auth/better-auth/commit/9d3852b2cf27d3c02c4e3b20a92fdd3ebaba4e83) fix: disable account linking by default - [`3c79387`](https://github.com/better-auth/better-auth/commit/3c79387c98811c3c34902943a2c53bf1ce75d5ca) test: update test cases for accountLinking default false ### 📊 Changes **10 files changed** (+109 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/account.test.ts` (+1 -0) 📝 `packages/better-auth/src/api/routes/account.ts` (+1 -1) 📝 `packages/better-auth/src/api/routes/callback.ts` (+1 -1) 📝 `packages/better-auth/src/oauth2/link-account.test.ts` (+86 -0) 📝 `packages/better-auth/src/oauth2/link-account.ts` (+1 -1) 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+5 -0) 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+5 -0) 📝 `packages/better-auth/src/plugins/mcp/mcp.test.ts` (+3 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+5 -0) 📝 `packages/core/src/types/init-options.ts` (+1 -1) </details> ### 📄 Description The documentation states `default: false`, but the internal logic was implemented as `default: true`. These should be aligned. I think account linking should only work when explicitly enabled, so I’m opening this PR. Closes https://github.com/better-auth/better-auth/issues/6848 <img width="677" height="267" alt="docs" src="https://github.com/user-attachments/assets/8850b81d-f997-441d-b7e3-ce08f6b1d13b" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Disable account linking by default to match the docs and prevent unintended linking. Linking now only happens when explicitly enabled. - **Bug Fixes** - Require account.accountLinking.enabled === true in account, callback, and OAuth linking flows. - Update option docs/types: default is now false. - Adjust tests to set enabled: true where needed; add coverage ensuring default-disabled behavior (returns account_not_linked). - **Migration** - If you use account linking, set account.accountLinking.enabled: true in your config. <sup>Written for commit 3c79387c98811c3c34902943a2c53bf1ce75d5ca. Summary will update automatically 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-15 22:00:16 -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#23822