[PR #8528] feat(magic-link): add additionalData support for sendMagicLink #16287

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

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

State: open
Merged: No


Summary

  • Added additionalData field to the magic link sign-in request body, allowing custom data to be passed from the client to the sendMagicLink function
  • Added additionalDataSchema option accepting a Zod schema for runtime validation and type safety of the additional data
  • When no schema is provided, defaults to Record<string, JsonValue> (unvalidated)
  • Updated documentation with usage examples and configuration details

Ported from #3417 and adapted to the current canary codebase (which has been refactored since the original PR — different imports, extracted body schema, ctx parameter instead of request).

Test plan

  • All 16 existing magic-link tests pass
  • Lint passes
  • Verify additionalData flows through to sendMagicLink callback with and without a custom schema
  • Verify type inference works correctly when additionalDataSchema is provided
**Original Pull Request:** https://github.com/better-auth/better-auth/pull/8528 **State:** open **Merged:** No --- ## Summary - Added `additionalData` field to the magic link sign-in request body, allowing custom data to be passed from the client to the `sendMagicLink` function - Added `additionalDataSchema` option accepting a Zod schema for runtime validation and type safety of the additional data - When no schema is provided, defaults to `Record<string, JsonValue>` (unvalidated) - Updated documentation with usage examples and configuration details Ported from #3417 and adapted to the current canary codebase (which has been refactored since the original PR — different imports, extracted body schema, `ctx` parameter instead of `request`). ## Test plan - [x] All 16 existing magic-link tests pass - [x] Lint passes - [x] Verify `additionalData` flows through to `sendMagicLink` callback with and without a custom schema - [x] Verify type inference works correctly when `additionalDataSchema` is provided
GiteaMirror added the pull-request label 2026-04-13 10:29:03 -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#16287