[GH-ISSUE #2067] Let name be missing instead of an empty string from user creation in magicLink plugin #9037

Closed
opened 2026-04-13 04:19:25 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @igoforth on GitHub (Mar 31, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2067

0d7fa1f99c/packages/better-auth/src/plugins/magic-link/index.ts (L221)

I think it's bad practice to permit an empty string in the optional name field during user creation. If it's at all possible, please consider using this pattern instead

...(name != null ? { name } : {}),
Originally created by @igoforth on GitHub (Mar 31, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2067 https://github.com/better-auth/better-auth/blob/0d7fa1f99cee25c0f1c4cf37a8ff4b1ad376a30e/packages/better-auth/src/plugins/magic-link/index.ts#L221 I think it's bad practice to permit an empty string in the optional name field during user creation. If it's at all possible, please consider using this pattern instead ```typescript ...(name != null ? { name } : {}), ```
GiteaMirror added the locked label 2026-04-13 04:19:25 -05:00
Author
Owner

@Kinfe123 commented on GitHub (May 29, 2025):

Currently, "name" is one of the required fields in the Better Auth schema, so we can't do that. However, we're trying to make the features as customizable as possible.

<!-- gh-comment-id:2918378600 --> @Kinfe123 commented on GitHub (May 29, 2025): Currently, "name" is one of the required fields in the Better Auth schema, so we can't do that. However, we're trying to make the features as customizable as possible.
Author
Owner

@igoforth commented on GitHub (May 29, 2025):

Would it make sense to delegate safety checks for the core schema to the internal adapter or an inner function instead of plugins having that responsibility?

<!-- gh-comment-id:2919302066 --> @igoforth commented on GitHub (May 29, 2025): Would it make sense to delegate safety checks for the core schema to the internal adapter or an inner function instead of plugins having that responsibility?
Author
Owner

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

Currently, "name" is one of the required fields in the Better Auth schema, so we can't do that. However, we're trying to make the features as customizable as possible.

Request to remove "name" here: https://github.com/better-auth/better-auth/issues/424

<!-- gh-comment-id:3607050427 --> @JPustkuchen commented on GitHub (Dec 3, 2025): > Currently, "name" is one of the required fields in the Better Auth schema, so we can't do that. However, we're trying to make the features as customizable as possible. Request to remove "name" here: https://github.com/better-auth/better-auth/issues/424
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9037