Change email doesn't support OTP #396

Closed
opened 2026-03-13 07:44:22 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jasongerbes on GitHub (Dec 14, 2024).

Describe the bug
The auth.api.changeEmail() method requires options.user.changeEmail.sendChangeEmailVerification() to be set so that an email verification email containing a unique token can be sent to the new email address.

However, the sendChangeEmailVerification() method does not support OTP-based verification - making the changeEmail() method incompatible with the Email OTP plugin.

To Reproduce
Steps to reproduce the behavior:

  1. Set up Email OTP with options.emailOTP.sendVerificationOTP() for sending email verification emails.
  2. Set user.changeEmail.enabled to true.
  3. Call auth.api.changeEmail().
  4. See error "Verification email isn't enabled."

Expected behavior
The auth.api.changeEmail() method should support sending OTP-based verification emails via the Email OTP plugin.

Screenshots
N/A

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
N/A

Originally created by @jasongerbes on GitHub (Dec 14, 2024). **Describe the bug** The `auth.api.changeEmail()` method requires `options.user.changeEmail.sendChangeEmailVerification()` to be set so that an email verification email containing a unique token can be sent to the new email address. However, the `sendChangeEmailVerification()` method does not support OTP-based verification - making the `changeEmail()` method incompatible with the Email OTP plugin. **To Reproduce** Steps to reproduce the behavior: 1. Set up Email OTP with `options.emailOTP.sendVerificationOTP()` for sending email verification emails. 2. Set `user.changeEmail.enabled` to `true`. 3. Call `auth.api.changeEmail()`. 4. See error "Verification email isn't enabled." **Expected behavior** The `auth.api.changeEmail()` method should support sending OTP-based verification emails via the Email OTP plugin. **Screenshots** N/A **Desktop (please complete the following information):** N/A **Smartphone (please complete the following information):** N/A **Additional context** N/A
GiteaMirror added the enhancementplugin labels 2026-03-13 07:44:22 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 12, 2025):

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

Issue Summary:

  • The issue involves the auth.api.changeEmail() method.
  • The method currently lacks support for OTP-based verification.
  • Errors occur when used with the Email OTP plugin.
  • No comments or updates from maintainers or other users have been made.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting on the issue.
  • If no updates are provided, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jun 12, 2025): Hi, @jasongerbes. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - The issue involves the `auth.api.changeEmail()` method. - The method currently lacks support for OTP-based verification. - Errors occur when used with the Email OTP plugin. - No comments or updates from maintainers or other users have been made. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting on the issue. - If no updates are provided, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Author
Owner

@xuchenhao001 commented on GitHub (Jul 31, 2025):

Hi I encountered the same issue. When I set overrideDefaultEmailVerification: true, I still cannot change the email address that has been verified: 400 BAD_REQUEST

{
    "code": "VERIFICATION_EMAIL_ISNT_ENABLED",
    "message": "Verification email isn't enabled"
}

It seems that plugins.emailOTP.overrideDefaultEmailVerification does not override user.changeEmail.sendChangeEmailVerification and user.deleteUser.sendDeleteAccountVerification

@xuchenhao001 commented on GitHub (Jul 31, 2025): Hi I encountered the same issue. When I set `overrideDefaultEmailVerification: true`, I still cannot change the email address that has been verified: `400 BAD_REQUEST` ```json { "code": "VERIFICATION_EMAIL_ISNT_ENABLED", "message": "Verification email isn't enabled" } ``` It seems that `plugins.emailOTP.overrideDefaultEmailVerification` does not override `user.changeEmail.sendChangeEmailVerification` and `user.deleteUser.sendDeleteAccountVerification`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#396