# Callback mismatch and wrong redirect\_uri

**URL:** <https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [October 16, 2024, 2:34pm UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981 "2024-10-16T14:34:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yourmindup](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yourmindup/32/61507_2.png) [@yourmindup](https://community.auth0.com/u/yourmindup)\
**Post date:** [October 16, 2024, 2:34pm UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981/1 "2024-10-16T14:34:39Z")

</div>

Hi all, I am looking for some help.

I use Auth0 for my login in a next js app. I have my custom domain with vercel, the vercel.app address and local host setup as callbacks:

_customdomain_/api/auth/callback,  
_vercel.app domain_/api/auth/callback.  
[http://localhost:3000/api/auth/callback](http://localhost:3000/api/auth/callback)

I have a problem with some clients that have strong ssl firewalls. As they try to log in, they get an error: ERR\_SSL\_PROTOCOL\_ERROR for _vercel.app domain_

This is strange tho cause they are accessing from _customdomain_

They seem to be redirected to the _vercel.app domain_ callback (which should not happen, as they are accessing from the _customdomain_).

I tried a few things.

I deleted the _vercel.app domain_ address and taken out the call back. I get an error from auth0 that there is a callback mismatch, it still looks for the _vercel.app domain_. The local host still works fine. It looks like when logging in with the _customdomain_ it redirects to the _vercel.app domain_ domain and then back to the _customdomain_ , it pick the wrong callback, even if it doesn’t I delete the _vercel.app domain_.

I deleted the _vercel.app domain_/api/auth/callback and got callback mismatch.  
I noticed that when I get the callback mismatch, there is this param inside the the url:  
code&redirect\_uri=https%3A%2F%2F vercel.app domain %2Fapi%2Fauth%2F  
which does not makes sense as that domain supposingly does not exist anymore

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 17, 2024, 5:44pm UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981/3 "2024-10-17T17:44:36Z")

</div>

Hi @yourmindup,

Welcome to the Auth0 Community!

Your app’s `redirect_uri` seems to be pointing to the wrong callback URL. Please ensure that your app’s `redirect_uri` points to the correct URL that you have specified in the **Allowed Callback URLs** list.

I also recommend checking your network activity when logging in to verify that you are passing in the correct `redirect_uri` value.

Ultimately, for successful authentication, the `redirect_uri` in your request needs to exactly match the one in the **Allowed Callback URLs** list.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![yourmindup](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yourmindup/32/61507_2.png) [@yourmindup](https://community.auth0.com/u/yourmindup)\
**Post date:** [October 18, 2024, 9:58am UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981/4 "2024-10-18T09:58:31Z")

</div>

Hi Rueben, Thank you, sounds great! with the nextJs sdk, would something like this do the job?:

```auto
handleAuth({
  callback: handleCallback({
    redirect_uri: `${window.location.origin}/api/auth/callback`
  })
})

```

or should I set anvironment variable AUTH0\_CALLBACK (which would be trickier as I use multiple domains)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 18, 2024, 4:48pm UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981/5 "2024-10-18T16:48:58Z")

</div>

Hi @yourmindup,

Yes, your code snippet will do the job in redirecting your user to your callback URL. 👍

This is a valid approach, considering you have multiple domains.

Thanks,  
Rueben

---

<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:** [November 1, 2024, 4:49pm UTC](https://community.auth0.com/t/callback-mismatch-and-wrong-redirect-uri/149981/6 "2024-11-01T16:49:49Z")

</div>

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