[PR #8572] [CLOSED] feat(magic-link): return url and token from sign-in #8072

Closed
opened 2026-03-13 13:59:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8572
Author: @mrgrauel
Created: 3/12/2026
Status: Closed

Base: canaryHead: feat/add-url-token-to-magic-link-return


📝 Commits (1)

  • 1f4083d feat(magic-link): return url and token from sign-in

📊 Changes

3 files changed (+152 additions, -18 deletions)

View changed files

📝 docs/content/docs/plugins/magic-link.mdx (+17 -0)
📝 packages/better-auth/src/plugins/magic-link/index.ts (+18 -2)
📝 packages/better-auth/src/plugins/magic-link/magic-link.test.ts (+117 -16)

📄 Description

Summary

  • restore the public signIn.magicLink HTTP response to status-only so the raw token never reaches browser clients
  • add an explicit returnToken option and a server-only auth.api.signInMagicLinkServer() helper for trusted server-side workflows
  • update docs and tests with the security warning, opt-in server-only usage, and hashed/custom storage coverage

Validation

  • pnpm --filter better-auth exec vitest run src/plugins/magic-link/magic-link.test.ts

Notes

  • authClient.signIn.magicLink() and POST /sign-in/magic-link still return only { status: true }
  • when returnToken: true is enabled, auth.api.signInMagicLinkServer() returns the generated url and raw token
  • the raw token remains opt-in and server-only; it is never added to the public HTTP/OpenAPI contract

🔄 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/8572 **Author:** [@mrgrauel](https://github.com/mrgrauel) **Created:** 3/12/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/add-url-token-to-magic-link-return` --- ### 📝 Commits (1) - [`1f4083d`](https://github.com/better-auth/better-auth/commit/1f4083dfc80fa72db9cac0fa0764db2992286d2e) feat(magic-link): return url and token from sign-in ### 📊 Changes **3 files changed** (+152 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/magic-link.mdx` (+17 -0) 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+18 -2) 📝 `packages/better-auth/src/plugins/magic-link/magic-link.test.ts` (+117 -16) </details> ### 📄 Description ## Summary - restore the public `signIn.magicLink` HTTP response to status-only so the raw token never reaches browser clients - add an explicit `returnToken` option and a server-only `auth.api.signInMagicLinkServer()` helper for trusted server-side workflows - update docs and tests with the security warning, opt-in server-only usage, and hashed/custom storage coverage ## Validation - `pnpm --filter better-auth exec vitest run src/plugins/magic-link/magic-link.test.ts` ## Notes - `authClient.signIn.magicLink()` and `POST /sign-in/magic-link` still return only `{ status: true }` - when `returnToken: true` is enabled, `auth.api.signInMagicLinkServer()` returns the generated `url` and raw `token` - the raw token remains opt-in and server-only; it is never added to the public HTTP/OpenAPI contract --- <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-03-13 13:59:07 -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#8072