Login From Website With Multiple Domains Using Single Application

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.

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

Hi Dawid,

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

The same is true for login.php:

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

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.

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

Thanks
Dawid

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=....

The server failed to refresh the .env and therefore pulled a default variable instead of AUTH0_CALLBACK_URL_US. Issue resolved.

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