Change email flow problem
Flows:
1. The user enters the new email address, and the backend uses the
auth.api.changeEmail
API to trigger the sending of a verification email.
2. The user receives the change email verification email.
3. The user clicks the email verification link.
4. The user receives the error "Verify email failed".
5. The database changes the user's email from the old address to the new one. (This is unexpected: Why did the database update the email despite the "Verify email failed" error?)
6. The user then receives another email, which appears to be triggered by the sendVerificationEmail
function. (This is also unexpected: Why was sendVerificationEmail
triggered when the sendChangeEmailVerification
process should have been the one requiring verification?)
7. The user clicks the email link again and receives the same "Verify email failed" error, but the database updates the email_verified
status to true.6 Replies
Hey can you send your auth config? I'll see if I can repro.
Better auth v1.2.9
My own verify email function
do you repro the problem?
I notice if I don't pass the callbackURL everything works fine
bump
encountering the exact same problem
Does your issue relate to getting a 302 error?
This specific issue the user is facing is already solved otherwise.
No, I'm getting a
401 Unauthorized
error.
I'll try setting up a minimal repro code.
The repro code
How to test it out
just read more carefully through the OP's code; seems like my case was different, using a different flow
will open a different thread