[GH-ISSUE #2197] changeEmail causes emailVerified being set to FALSE, after clicking on verify link. #26420

Closed
opened 2026-04-17 16:59:08 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @elansx on GitHub (Apr 9, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2197

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Enable option to change email
  2. Click on email verification link
  3. See email being changed in database and emailVerified set to false

Current vs. Expected behavior

Current behavior: after clicking on verification link email is being unverified.

Expected behavior: After click on verification link new email should updated and be verified.

What version of Better Auth are you using?

1.2.5

Provide environment information

- Windows
- Sveltekit
- MongoDB Adapter

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

export const auth = betterAuth({
    database: mongodbAdapter(client),
    user: { 
        changeEmail: { 
            enabled: true,
            sendChangeEmailVerification: async ({ user, url, token }, request) => {
                console.log(user, url, token)
            }
         }
     }
});

Additional context

No response

Originally created by @elansx on GitHub (Apr 9, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2197 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Enable option to change email 2. Click on email verification link 3. See email being changed in database and **emailVerified** set to **false** ### Current vs. Expected behavior Current behavior: after clicking on verification link email is being unverified. Expected behavior: After click on verification link new email should updated and be verified. ### What version of Better Auth are you using? 1.2.5 ### Provide environment information ```bash - Windows - Sveltekit - MongoDB Adapter ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript export const auth = betterAuth({ database: mongodbAdapter(client), user: { changeEmail: { enabled: true, sendChangeEmailVerification: async ({ user, url, token }, request) => { console.log(user, url, token) } } } }); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-17 16:59:08 -05:00
Author
Owner

@Bekacru commented on GitHub (Apr 10, 2025):

This is intended behavior. The new email isn't verified yet.

<!-- gh-comment-id:2793588351 --> @Bekacru commented on GitHub (Apr 10, 2025): This is intended behavior. The new email isn't verified yet.
Author
Owner

@Bekacru commented on GitHub (Apr 10, 2025):

change email verification is meant to be sent to the existing email address not to the new email

<!-- gh-comment-id:2794666100 --> @Bekacru commented on GitHub (Apr 10, 2025): change email verification is meant to be sent to the existing email address not to the new email
Author
Owner

@elansx commented on GitHub (Apr 10, 2025):

change email verification is meant to be sent to the existing email address not to the new email

Yes, just figured this out too. Sorry for deleting previous comment.

The issue with my situation was that I'm not using this function:

emailVerification: { sendVerificationEmail: async ({ email, user, url, token }) => { } }

I'm using emailOTP as signup/signin, so I didn't even have this emailVerification option and sendVerificationEmail weren't triggered.

Sad that these all email functions doesn't support OTP yet.

<!-- gh-comment-id:2794675432 --> @elansx commented on GitHub (Apr 10, 2025): > change email verification is meant to be sent to the existing email address not to the new email Yes, just figured this out too. Sorry for deleting previous comment. The issue with my situation was that I'm not using this function: `emailVerification: { sendVerificationEmail: async ({ email, user, url, token }) => { } }` I'm using emailOTP as signup/signin, so I didn't even have this emailVerification option and sendVerificationEmail weren't triggered. Sad that these all email functions doesn't support OTP yet.
Author
Owner

@Bekacru commented on GitHub (Apr 10, 2025):

all good. yeah I can see how that's confusing. we'll support change email flow with email-otp plugin soon!

<!-- gh-comment-id:2794693253 --> @Bekacru commented on GitHub (Apr 10, 2025): all good. yeah I can see how that's confusing. we'll support change email flow with email-otp plugin soon!
Author
Owner

@MatteoGauthier commented on GitHub (May 2, 2025):

@Bekacru Cool, did you also plan to add to support this behavior in the Magic Link plugin ?

<!-- gh-comment-id:2846938874 --> @MatteoGauthier commented on GitHub (May 2, 2025): @Bekacru Cool, did you also plan to add to support this behavior in the Magic Link plugin ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#26420