# User email verification appears to fail for changed email but actually succeeds

**URL:** <https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140>\
**Category:** Get Help\
**Tags:** email-verification, user-management\
**Created:** [March 3, 2025, 5:49am UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140 "2025-03-03T05:49:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 3, 2025, 5:49am UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/1 "2025-03-03T05:49:33Z")

</div>

We’ve implemented a flow whereby a user is supposed to be able to change the email address of their account. For this purpose we use the management api like so:

```ts
        await ctx.auth0.users.update(
          { id: oldUser.sub },
          { email, verify_email: true },
        );

```

This works as expected. We log the user out. They receive an email to verify their new email address. However, when they click the link (and we have tested this across different email providers) they are informed that the verification failed.

But seconds later they receive another email informing them of their successful verification and checking the user in the auth0 dashboard also reveals that their new email is now verified.

In the logs I see the verification is run twice: once successfully and another time it fails. But the user only sees the failed attempt even though it was actually successful.

For the failed attempt it gives “invalid result url” though the result url should be the exact same as the one for the successful verification. Why is this run twice? How do I prevent it?

The same thing does not happen for the first verification email that users are sent upon signing up for the first time.

---

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 3, 2025, 5:52am UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/2 "2025-03-03T05:52:18Z")

</div>

I would add screenshots but it won’t let me embed media items in a post, I always get an error.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 3, 2025, 8:17pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/4 "2025-03-03T20:17:28Z")

</div>

Hi @anna.fasching

Welcome to the Auth0 Community!

Could you please let me know if in your logs the Failed Verification appears first or the Successful Verification?

By any chance, do you test this with users creating in the dashboard or with users which signed up?  
The issue might be caused by the fact that an user created within the dashboard have an empty value for `{{ application.callback_origin }}` resulting in an invalid redirect\_url. You can read more about that in this [community post](https://community.auth0.com/t/redirect-to-for-classic-login-doesnt-work/33464).

Also, this issue could be caused by multiple requests. Did you by any chance click the link multiple times when verifying the new mail?

Alternatively, if you are using an email template, you can attempt to delete the Redirect To attribute.

You can also double check if the email instance you are testing with automatically click the user’s link for them or if they are using click tracking. This can be an issue specifically with Office 365. You can check if you receive the **Successful Verification** message prior to clicking the link. You can try using an email client which does not send the email to the end-user inbox such as [mailtrap.io](http://mailtrap.io).

Let me know if the information above was helpful or if you have any other questions regarding the matter!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 4, 2025, 6:37am UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/5 "2025-03-04T06:37:42Z")

</div>

Hi Nik, thank you for the prompt response.

I can add screenshots now 😉

I tried it again just now with a freshly signed up user that was not created via the dashboard. I still have the same problem. As you can see, I get the success first and mere milliseconds later I get a failed response with a very odd result url.

 ![successful verification](https://global.discourse-cdn.com/auth0/original/3X/0/f/0f73f6608f19322095ea9ebc95d888fc0420ecd0.png)  
 ![failed verification](https://global.discourse-cdn.com/auth0/original/3X/d/d/ddd86aed558b70ade1d2035f00a47d1595120b52.png)

I did not click the link twice. When I do, the error is still `invalid result url` but the result url changes to this:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/b/cb675fb78be1c7ebfb09b3f5d849ccbe8fd8eaa9.png)  
The error page I see after clicking the click is still “Email could not be verified” which in this case is also not true because the actual error message should be “Email has already been verified” or something of the sort.

This is what our Redirect To attribute looks like in the email template:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/8/184a35e90d2335654ddba5236eb6e8fbd6f73c0a.png)

Deleting it entirely does work but that’s not really our preferred solution. Is there a way to fix the behaviour of the redirect?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 4, 2025, 5:22pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/6 "2025-03-04T17:22:11Z")

</div>

Hi again,

Could you try providing a default route inside the `Redirect To` field to see if the issue persists?

```auto
{{application.callback_domain | default: "https://default-domain.com"}}/account?email_activation=1

```

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 5, 2025, 2:08pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/7 "2025-03-05T14:08:58Z")

</div>

Hm… providing the default route like so:

```auto
{{ application.callback_domain | default: "http://127.0.0.1:3000" }}/account?email_activation=1

```

does redirect to the specified default. But that also means that the user is just redirected to the login without feedback as to whether or not the performed action worked.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 5, 2025, 5:55pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/8 "2025-03-05T17:55:15Z")

</div>

Hi @anna.fasching

I have taken a look at your tenants and I could not find an application which points to the specified url in the `default` option.

Just so you know, the `{{application.callback_domain}}` will use the first URL in the list of the **Allowed Callbacks URLs** of the application. Is the `http://127.0.0.1:3000` the first one in the list of the application that you are using or is it a different one?

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 6, 2025, 6:42am UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/9 "2025-03-06T06:42:02Z")

</div>

Hey Nik,

thank you for sticking with me. I do know that the `{{application.callback_domain}}` will use the first URL in the list of the **Allowed Callbacks URLs** but when I use the first one from that list (`http://localhost:3000/api/auth/callback`) as the default it also does not redirect correctly. Then I just end up with a 404.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/4/5497c090cce7e1c9cab87e3e8a293025631acdb2.png)

For obvious reasons we haven’t tested this in our staging and production tenants yet so I am wondering if the development environment might be causing problems here that would not occur in stage or production but I don’t know.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 6, 2025, 5:13pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/10 "2025-03-06T17:13:45Z")

</div>

Hi,

Thanks for the additional info.

The dev environment might cause the issue since the specific webpage might not be configured. Just to double check with you, the initial default route that you have configured, is that the URL that you wish to redirect the user to after the email has been changed?

If so, would the URL be something like` http://127.0.0.1:3000/account?email_activation=1`?  
If not, is the first URL in your **Allowed Callback URL** list the one that you want to redirect to? If you want to redirect the user to the homepage, have you tried using `http://localhost:3000/account?email_activation=1` or `http://localhost:3000/callback/account?email_activation=1`?

Let me know what is the behaviour when trying those URLs instead.

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![anna.fasching](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anna.fasching/32/71656_2.png) [@anna.fasching](https://community.auth0.com/u/anna.fasching)\
**Post date:** [March 11, 2025, 2:13pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/11 "2025-03-11T14:13:53Z")

</div>

Hey Nik, in the end I stuck with the `default` option and configured a page to show the users the response of the verification (error or success) and made that page accessible outside of being authenticated (since users are logged out by the email change flow).

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [March 11, 2025, 3:17pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/12 "2025-03-11T15:17:25Z")

</div>

Thanks for the update!

Glad to help and know you found a solution on the matter!

If you have any other questions, feel free to leave a reply or post again on the community!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 25, 2025, 3:17pm UTC](https://community.auth0.com/t/user-email-verification-appears-to-fail-for-changed-email-but-actually-succeeds/183140/13 "2025-03-25T15:17:28Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
