feat(magic-link): require name for signup
What changes were made and why:
- Added a new configuration option
requireNameForSignUpin the Magic Link plugin. - When enabled, any attempt to create a new user via Magic Link without a non-empty
namefield will fail. - This ensures new users always have a
name, improving data consistency and preventing incomplete user records. - Updated the plugin documentation to include the new requireNameForSignUp option and describe its behavior.
Relevant context:
- Currently, Magic Link signup allows creating users without a name.
- The recommended workaround (from issue comment) was to collect
namelater, but adding native support avoids extra steps and simplifies the flow.
Breaking changes / deprecations:
- No breaking changes.
- Flows without
requireNameForSignUpenabled remain unchanged.
Tests / screenshots:
- Added test to verify that signup fails if
nameis missing whenrequireNameForSignUpis true.
Related issues / discussions:
- Closes #5139
Summary by cubic
Added an option to require a non-empty name when creating new users via Magic Link signup. This prevents nameless accounts and improves data consistency.
-
New Features
- Added requireNameForSignUp (default: false).
- When enabled (and sign up isn’t disabled), new user signup without a non-empty name redirects with ?error=NAME_REQUIRED_FOR_SIGNUP.
- Updated docs to cover the new option.
@ouariachi is attempting to deploy a commit to the better-auth Team on Vercel.
A member of the Team first needs to authorize it.
better-auth
npm i https://pkg.pr.new/better-auth/better-auth@5140
@better-auth/cli
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@5140
@better-auth/core
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/core@5140
@better-auth/expo
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/expo@5140
@better-auth/sso
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/sso@5140
@better-auth/stripe
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/stripe@5140
@better-auth/telemetry
npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/telemetry@5140
commit: 5784a96
I think you forgot to update your tests to use the lowercase error name, yet CI didn't fail. Is your test not working?
I think you forgot to update your tests to use the lowercase error name, yet CI didn't fail. Is your test not working?
Yes, I was checking the error code in the signIn response when it should be in the verify response.