# Issue with Callback URL Mismatch

**URL:** <https://community.auth0.com/t/issue-with-callback-url-mismatch/120560>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [November 9, 2023, 2:12pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560 "2023-11-09T14:12:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![german1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/german1/32/52320_2.png) [@german1](https://community.auth0.com/u/german1)\
**Post date:** [November 9, 2023, 2:12pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/1 "2023-11-09T14:12:58Z")

</div>

Hi Support Team,

I hope this message finds you well. I am currently facing an issue with Auth0 while using wildcards in the Callback URL configuration.

In the Auth0 dashboard, I have configured the Callback URL as http://\*.localhost:3000/api/auth/callback. The login process works fine on the Auth0 login site when initiated from [http://test.localhost:3000](http://test.localhost:3000/). However, after the login, the callback URL seems to be incorrect, resulting in the following error:

```auto
CallbackHandlerError: Callback handler failed. CAUSE: Missing state cookie from login request (check login URL, callback URL, and cookie config).

```

Upon further investigation, it appears that the login cookie is created under the domain [http://test.localhost:3000](http://test.localhost:3000/), while the callback URL is set as [http://localhost:3000/api/auth/callback?code=UupJEMc9](http://localhost:3000/api/auth/callback?code=UupJEMc9)…

Can you guide me on how to solve this?

Thank you for your assistance.

Best regards,

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [November 13, 2023, 9:48am UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/2 "2023-11-13T09:48:46Z")

</div>

Hey tehre @german1 ! Welcome to Auth0!

It looks like the way you use wildcard will not work.

Please take a look at this topic (wildcards with localhost:port) - [Wildcards for subdomain callbacks not working](https://community.auth0.com/t/wildcards-for-subdomain-callbacks-not-working/45187)

General guidance for wildcards - [Subdomain URL Placeholders](https://auth0.com/docs/get-started/applications/wildcards-for-subdomains#wildcard-url-placeholders)

Thanks!

---

<div class="post-metadata">

**Author:** ![german1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/german1/32/52320_2.png) [@german1](https://community.auth0.com/u/german1)\
**Post date:** [November 13, 2023, 2:00pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/4 "2023-11-13T14:00:59Z")

</div>

I tested using another path in the url like [http://test.foo.localhost:3000](http://test.foo.localhost:3000) and still happens.

We deployed the project in amplify and we keep getting the same error, it doesn’t only happen in local environment.

We deployed and configured under a url like this https://\*.foo.example.com  
If we execute the login from [https://test.foo.example.com](https://test.foo.example.com) the callback url is set as [https://foo.example.com](https://foo.example.com).

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [November 14, 2023, 9:35am UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/7 "2023-11-14T09:35:03Z")

</div>

Hey @german1 , thank you for following up.

I double checked locally by initializing auth0 client to callback to a single level subdomain callback URL like `https://subdomain.domain.com` and allowing `https://*.domain.com` on my Auth0 tenant and it works well.

However, unfortunately, it will not work with multilevel subdomains.

---

<div class="post-metadata">

**Author:** ![german1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/german1/32/52320_2.png) [@german1](https://community.auth0.com/u/german1)\
**Post date:** [November 14, 2023, 2:16pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/8 "2023-11-14T14:16:16Z")

</div>

I tested with only one subdomain and the final callback url throw a page error.  
Could you share with us the repo and the tenant config that you use?

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/7/279fa671cbf39f9b11c2a2a268185a5390a761a8.png)

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [November 14, 2023, 3:43pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/9 "2023-11-14T15:43:04Z")

</div>

Hi @german1 ,

I don’t think the issue is with the callback mismatch. A few members had a similar issue ad the reason were outdated packages. Here’s a [topic](https://community.auth0.com/t/nextjs-vercel-application-api-auth-callback-failing-despite-succeeding-locally/100233/2) for reference.

I am using the repo associated with this [doc](https://auth0.com/docs/quickstart/spa/react/01-login) for a Single Page App.  
For the URL you can use any specific single subdomain URL.

To test it, it’s enough to send an [/authorize](https://auth0.com/docs/api/authentication#database-ad-ldap-passive-) request (an example below) with a redirect\_uri param set to any specific single subdomain url (in the request neither in your app code do not use any wildcard; wildcard **only** in Auth0 tenant’s settings for a specific app like https://\*.google.com/domains/) to initiate the login flow and once authenticated, to be redirected to your page.

```auto
https://{your_auth0_domain}.com/authorize?client_id={xxx}&scope=openid+profile+email&redirect_uri={url}&response_type=code

```

Hope this helps!

---

<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 28, 2023, 3:43pm UTC](https://community.auth0.com/t/issue-with-callback-url-mismatch/120560/10 "2023-11-28T15:43:05Z")

</div>

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