Email Verification Callback after Email Change
When you change the email of a verified user, and provide a callback url, an email is sent to their current email to confirm the change with that callback, but then another email is sent to the new email to mark their new email as verified, but what will the callback url for that email be? How can we customise it?
8 Replies
can you share you auth config?
I don't think my config is relevant
Then atleast share your email reset logic
create endpoint
explain please?
I've noticed that the email verification to the NEW email after email change uses this callback? But this callback is supposed to be for the OLD email
you can include the callback url in your url by exporting the token (if its available in this function, i think so)
for e.g. like this: (this is for resetting password, you can see how the endpoint works by console logging the url)
const callbackURL =
${BETTER_AUTH_URL}/v1/auth/reset-password/${token}?callbackURL=${SITE_URL}/auth/forget/password
if you can't export the token then im out of ideasThat's not the issue, the issue is I fire this:
OLD email address receives an email to confirm change to the NEW email. I click on the click and get redirected to
"/admin/account?emailUpdateRedirect=true"
Then Better Auth automatically sends an email verification to the NEW email, the NEW email receives an email, I click on the click and it redirects me to "/admin/account?emailUpdateRedirect=true"
also ???I think that you should try doing this. (as then the callback should be correct on the new email) changeEmail function probably adresses this callbackURL to both
sendChangeEmailVerification
and sendVerificationEmail
, hence why it's the same on old and new email.