Add signUpOnVerification support for emailOTP plugin to auto-generate temp name #2100

Closed
opened 2026-03-13 09:27:13 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @rohityadav-sas on GitHub (Oct 10, 2025).

Is this suited for github?

  • Yes, this is suited for github

Currently, the emailOTP plugin does not provide a signUpOnVerification option similar to the phoneNumber plugin.
This makes it difficult to automatically create a user profile (e.g., generate a random or derived username) when signing up with email OTP.
For example, while phoneNumber has getTempEmail and getTempName, the same behavior is missing for emailOTP.

Describe the solution you'd like

It would be helpful if the emailOTP plugin included an optional signUpOnVerification configuration similar to the phoneNumber plugin allowing developers to define:

  • A getTempName function to generate a random name

Example:

emailOTP({
  overrideDefaultEmailVerification: true,
  async sendVerificationOTP({ email, otp, type }) {
    // existing code...
  },
  signUpOnVerification: {
    getTempName: (email) => `User-${email.split('@')[0]}`
  }
})

Describe alternatives you've considered

I’m considering using Before Hooks to handle user creation and generate temporary names as a workaround, but I’m not sure if this is the best approach. I’d like confirmation from others on whether this is the recommended way to handle it for now.

Additional context

In the phoneNumber plugin, we can generate temporary user data like:

signUpOnVerification: {
  getTempEmail: (phoneNumber) => `temp-${phoneNumber}@example.com`,
  getTempName: (phoneNumber) => `User-${phoneNumber.slice(-4)}`
}
Originally created by @rohityadav-sas on GitHub (Oct 10, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Currently, the `emailOTP` plugin does not provide a `signUpOnVerification` option similar to the `phoneNumber` plugin. This makes it difficult to automatically create a user profile (e.g., generate a random or derived username) when signing up with email OTP. For example, while phoneNumber has getTempEmail and getTempName, the same behavior is missing for emailOTP. ### Describe the solution you'd like It would be helpful if the `emailOTP` plugin included an optional `signUpOnVerification` configuration similar to the `phoneNumber` plugin allowing developers to define: - A `getTempName` function to generate a random name Example: ``` emailOTP({ overrideDefaultEmailVerification: true, async sendVerificationOTP({ email, otp, type }) { // existing code... }, signUpOnVerification: { getTempName: (email) => `User-${email.split('@')[0]}` } }) ``` ### Describe alternatives you've considered I’m considering using **Before Hooks** to handle user creation and generate temporary names as a workaround, but I’m not sure if this is the best approach. I’d like confirmation from others on whether this is the recommended way to handle it for now. ### Additional context In the `phoneNumber` plugin, we can generate temporary user data like: ``` signUpOnVerification: { getTempEmail: (phoneNumber) => `temp-${phoneNumber}@example.com`, getTempName: (phoneNumber) => `User-${phoneNumber.slice(-4)}` } ```
GiteaMirror added the enhancement label 2026-03-13 09:27:13 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 9, 2026):

Hi, @rohityadav-sas. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested a signUpOnVerification feature for the emailOTP plugin, similar to the phoneNumber plugin.
  • The feature would allow automatic user creation with a temporary name after email OTP verification.
  • You proposed including a getTempName function to generate the temporary name.
  • You inquired if using Before Hooks is still the best workaround for this functionality.
  • There has been no further activity or comments on this issue.

Next Steps:

  • Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue.
  • If I do not hear back within 7 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 9, 2026): Hi, @rohityadav-sas. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested a `signUpOnVerification` feature for the `emailOTP` plugin, similar to the `phoneNumber` plugin. - The feature would allow automatic user creation with a temporary name after email OTP verification. - You proposed including a `getTempName` function to generate the temporary name. - You inquired if using Before Hooks is still the best workaround for this functionality. - There has been no further activity or comments on this issue. **Next Steps:** - Please let me know if this feature request is still relevant to the latest version of better-auth by commenting on this issue. - If I do not hear back within 7 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2100