# Login From Website With Multiple Domains Using Single Application

**URL:** <https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [July 15, 2024, 7:34am UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889 "2024-07-15T07:34:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![janik.driehaus](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/janik.driehaus/32/12805_2.png) [@janik.driehaus](https://community.auth0.com/u/janik.driehaus)\
**Post date:** [July 15, 2024, 7:34am UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/1 "2024-07-15T07:34:29Z")

</div>

I have the following scenario:

- Our German branch uses `www.website.de`
- Our American branch uses `www.website.us`

Both are connected to a single Auth0 Application. The websites use the PHP framework to handle authentication and integration with the Auth0 tenant. My issue is that logging in on `website.de/login` is successful and redirects correctly. Logging in from `website.us/login` fails (or appears to) and redirects to `website.de/callback`.

How can I connect the two domains so that they recognise a user? Signing in on `website.de` should authenticate you for `website.us` and vice-versa. These two domains for the website are used to display branch-specific content on the same underlying website (shared PHP files).

I can provide `.env`, `callback.php`, `login.php`, and `logout.php` with critical data removed as needed.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [July 15, 2024, 12:34pm UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/2 "2024-07-15T12:34:12Z")

</div>

Hi @janik.driehaus

Welcome back to the Auth0 Community!

Thank you for posting your question. If you are able, can you share with me both requests that your application makes during login? Specifically, I would need the redurect\_uri parameter as it is used as a callback URL. I’ve checked your tenant settings, and as you said in your question, both URLs are present in the Allowed Callback URLs section of your application.

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![janik.driehaus](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/janik.driehaus/32/12805_2.png) [@janik.driehaus](https://community.auth0.com/u/janik.driehaus)\
**Post date:** [July 15, 2024, 12:53pm UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/4 "2024-07-15T12:53:05Z")

</div>

Hi Dawid,

Upon checking, I came to notice that no redirect URI appears to be set. Instead, a header is set within `callback.php`:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/3/c/3c4ef6c58e848f11868852200afbb94ca4b4514c.png)

The same is true for `login.php`:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/7/97c60a89a9b2712be794e57f307eb46498977bba.png)

Would the redirect URI need to be set based on the domain (DE/US)?

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [July 15, 2024, 2:17pm UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/5 "2024-07-15T14:17:15Z")

</div>

Hi @janik.driehaus

Yes, the redirect\_uri needs to be set separately for each domain, as this parameter is later used as the callback URL.

> **[Redirect Users](https://auth0.com/docs/authenticate/login/redirect-users-after-login#:~:text=Using%20state%20parameters-,During%20a%20user%27s%20authentication%2C%20the%20redirect_uri%20request%20parameter%20is%20used%20as,.,-Cookie%20or%20browser)**
>
> Describes how to redirect users to URLs that have not been added to the AllowList.

Can you update the settings and let me know if that helped you?

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![janik.driehaus](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/janik.driehaus/32/12805_2.png) [@janik.driehaus](https://community.auth0.com/u/janik.driehaus)\
**Post date:** [July 15, 2024, 2:38pm UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/6 "2024-07-15T14:38:57Z")

</div>

Hi Dawid,

Adding ‘redirect\_uri’ had no effect on `website.de`. Meanwhile, `website.us` redirected to a blank page at `website.de/callback.php?code=...`.

---

<div class="post-metadata">

**Author:** ![janik.driehaus](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/janik.driehaus/32/12805_2.png) [@janik.driehaus](https://community.auth0.com/u/janik.driehaus)\
**Post date:** [July 17, 2024, 9:13am UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/8 "2024-07-17T09:13:44Z")

</div>

The server failed to refresh the .env and therefore pulled a default variable instead of AUTH0\_CALLBACK\_URL\_US. Issue resolved.

---

<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:** [July 31, 2024, 9:13am UTC](https://community.auth0.com/t/login-from-website-with-multiple-domains-using-single-application/138889/9 "2024-07-31T09:13:48Z")

</div>

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