[GH-ISSUE #5139] Add requireNameForSignUp option to Magic Link plugin #10170

Open
opened 2026-04-13 06:08:26 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @ouariachi on GitHub (Oct 7, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/5139

Originally assigned to: @ping-maxwell on GitHub.

Is this suited for github?

  • Yes, this is suited for github

Yes. Currently, the Magic Link plugin allows new users to be created without providing a name. In some applications, having a name is required for new accounts, and allowing sign-ups without it can lead to incomplete user profiles or inconsistent data. There is no existing option to enforce this requirement during sign-up, which makes it difficult to ensure that all new users provide a name when registering via Magic Link.

Describe the solution you'd like

I would like a new configuration option for the Magic Link plugin, called requireNameForSignUp. When set to true, any sign-in attempt that triggers the creation of a new user must include a non-empty name field in the request. If the name is missing or empty, the sign-up should fail gracefully with an appropriate error, without exposing whether the email already exists (to prevent user enumeration). This ensures that all new users created via Magic Link have a name.

Describe alternatives you've considered

I have read the recommended solution in this comment, which suggests handling user creation flows carefully. While this approach works, having native support for requiring the name field during Magic Link signup would simplify validation and prevent inconsistent user creation.

Additional context

No response

Originally created by @ouariachi on GitHub (Oct 7, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/5139 Originally assigned to: @ping-maxwell on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Yes. Currently, the Magic Link plugin allows new users to be created without providing a name. In some applications, having a name is required for new accounts, and allowing sign-ups without it can lead to incomplete user profiles or inconsistent data. There is no existing option to enforce this requirement during sign-up, which makes it difficult to ensure that all new users provide a name when registering via Magic Link. ### Describe the solution you'd like I would like a new configuration option for the Magic Link plugin, called `requireNameForSignUp`. When set to true, any sign-in attempt that triggers the creation of a new user must include a non-empty name field in the request. If the name is missing or empty, the sign-up should fail gracefully with an appropriate error, without exposing whether the email already exists (to prevent user enumeration). This ensures that all new users created via Magic Link have a name. ### Describe alternatives you've considered I have read the recommended solution in [this comment](https://github.com/better-auth/better-auth/issues/4728#issuecomment-3304537808), which suggests handling user creation flows carefully. While this approach works, having native support for requiring the `name` field during Magic Link signup would simplify validation and prevent inconsistent user creation. ### Additional context _No response_
GiteaMirror added the credentials label 2026-04-13 06:08:26 -05:00
Author
Owner

@JPustkuchen commented on GitHub (Dec 3, 2025):

See https://github.com/better-auth/better-auth/issues/424 for the (valid) request to remove "name" or at least make it nullable and not needed in the object keys.

<!-- gh-comment-id:3607054621 --> @JPustkuchen commented on GitHub (Dec 3, 2025): See https://github.com/better-auth/better-auth/issues/424 for the (valid) request to remove "name" or at least make it nullable and not needed in the object keys.
Author
Owner

@bytaesu commented on GitHub (Jan 7, 2026):

Hi @ouariachi,

In the next major release, we'll first make the name field optional. After that, instead of updating each plugin individually, we'll review whether to provide a global option like requireName for the name field.

<!-- gh-comment-id:3719172515 --> @bytaesu commented on GitHub (Jan 7, 2026): Hi @ouariachi, In the next major release, we'll first make the name field optional. After that, instead of updating each plugin individually, we'll review whether to provide a global option like `requireName` for the name field.
Author
Owner

@JPustkuchen commented on GitHub (Jan 7, 2026):

Thank you for caring for this @bytaesu - please note that there's a similar issue for slugs in Organizations: https://github.com/better-auth/better-auth/issues/6662 / https://github.com/better-auth/better-auth/pull/5955 Maybe both can be fixed similarly?

<!-- gh-comment-id:3719499725 --> @JPustkuchen commented on GitHub (Jan 7, 2026): Thank you for caring for this @bytaesu - please note that there's a similar issue for slugs in Organizations: https://github.com/better-auth/better-auth/issues/6662 / https://github.com/better-auth/better-auth/pull/5955 Maybe both can be fixed similarly?
Author
Owner

@bytaesu commented on GitHub (Feb 2, 2026):

Note

We'll either find a way to do this without a breaking change or try again in a major release like v2 🙂

<!-- gh-comment-id:3837085807 --> @bytaesu commented on GitHub (Feb 2, 2026): > [!NOTE] > We'll either find a way to do this without a breaking change or try again in a major release like v2 🙂
Author
Owner

@JPustkuchen commented on GitHub (Feb 3, 2026):

@bytaesu what's the final state here now in released code? I'm a bit confused after reopening. Thanks!

<!-- gh-comment-id:3840284065 --> @JPustkuchen commented on GitHub (Feb 3, 2026): @bytaesu what's the final state here now in released code? I'm a bit confused after reopening. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10170