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

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

Original Pull Request: https://github.com/better-auth/better-auth/pull/8572

State: closed
Merged: No


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
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8572 **State:** closed **Merged:** No --- ## 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
GiteaMirror added the pull-request label 2026-04-13 10:29:32 -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#16318