[PR #7600] feat: add magic-link prefix to token storage #24335

Open
opened 2026-04-15 22:18:55 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7600
Author: @xiaoyu2er
Created: 1/25/2026
Status: 🔄 Open

Base: mainHead: feat/magic-link-token-prefix


📝 Commits (2)

  • 21a117d feat: add magic-link prefix to token storage
  • ffe47e9 fix: add backward compatibility for magic-link tokens without prefix

📊 Changes

2 files changed (+78 additions, -10 deletions)

View changed files

📝 packages/better-auth/src/plugins/magic-link/index.ts (+11 -3)
📝 packages/better-auth/src/plugins/magic-link/magic-link.test.ts (+67 -7)

📄 Description

Add 'magic-link:' prefix to token identifiers when storing verification values, matching the pattern used in one-time-token plugin. This helps distinguish token types in the database.

Changes

  • Add prefix when creating verification value
  • Add prefix when finding verification value
  • Update tests to use prefix when looking up stored tokens

Summary by cubic

Add a "magic-link:" prefix to verification token identifiers in the magic link plugin to prevent collisions and match one-time-token storage. Verification also supports old tokens without the prefix for backward compatibility.

  • Refactors
    • Apply prefix when creating verification values.
    • Check prefixed identifier first when verifying, then fallback to non-prefixed tokens.
    • Update tests to use the prefixed identifier and cover backward compatibility.

Written for commit ffe47e9d12. 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/7600 **Author:** [@xiaoyu2er](https://github.com/xiaoyu2er) **Created:** 1/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/magic-link-token-prefix` --- ### 📝 Commits (2) - [`21a117d`](https://github.com/better-auth/better-auth/commit/21a117d90be74b7842940ab87cf9a20651b527e1) feat: add magic-link prefix to token storage - [`ffe47e9`](https://github.com/better-auth/better-auth/commit/ffe47e9d12738db820179de6bd71ca8129d26e90) fix: add backward compatibility for magic-link tokens without prefix ### 📊 Changes **2 files changed** (+78 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+11 -3) 📝 `packages/better-auth/src/plugins/magic-link/magic-link.test.ts` (+67 -7) </details> ### 📄 Description Add 'magic-link:' prefix to token identifiers when storing verification values, matching the pattern used in one-time-token plugin. This helps distinguish token types in the database. ## Changes - Add prefix when creating verification value - Add prefix when finding verification value - Update tests to use prefix when looking up stored tokens <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a "magic-link:" prefix to verification token identifiers in the magic link plugin to prevent collisions and match one-time-token storage. Verification also supports old tokens without the prefix for backward compatibility. - **Refactors** - Apply prefix when creating verification values. - Check prefixed identifier first when verifying, then fallback to non-prefixed tokens. - Update tests to use the prefixed identifier and cover backward compatibility. <sup>Written for commit ffe47e9d12738db820179de6bd71ca8129d26e90. 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-15 22:18:55 -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#24335