# Universal Login - single Universal Login page(and route) for multiple application within 1 tenant

**URL:** <https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [August 14, 2025, 12:36pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614 "2025-08-14T12:36:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mykola.revutskyi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mykola.revutskyi/32/73705_2.png) [@mykola.revutskyi](https://community.auth0.com/u/mykola.revutskyi)\
**Post date:** [August 14, 2025, 12:36pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/1 "2025-08-14T12:36:12Z")

</div>

Hi Everyone,

I want to build 2 MVC applications within 1 tenant, but I want to have a single Universal Login page for them. Page also needs to be customized with some html+css markup

Desired flow: user navigates by login url → Universal Login Page → post-login redirection to corresponding MVC app(based on flag in user metadata)

How can I achieve that?

From what I currently see it looks like each application is registered in auth0 separately  
so that I can customize login page for 1st MVC app, 2nd MVC app, etc.

How to configure both apps to share and use 1 Universal Login page so that I could route users to it?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [August 14, 2025, 2:57pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/3 "2025-08-14T14:57:28Z")

</div>

Hi @mykola.revutskyi,

Welcome to the Auth0 Community!

The default and recommended behavior in Auth0 is to have a single, customized Universal Login page for multiple applications within one tenant. The routing logic you described—sending a user to a specific application based on their profile—is best handled by a **Post-Login Action**.

The core concept is that **Universal Login is a tenant-level feature, not an application-level one**. When you customize the Universal Login page, you customize it for every application your tenant uses.

Your goal of redirecting a user to MVC App 1 or MVC App 2 based on a metadata flag is a common requirement. The secure way to implement this is to have the login flow return information to the calling application, which then performs the final redirection. An Auth0 Action is the perfect tool for securely providing this information.

Here is a step-by-step guide to achieve your desired flow.

#### 1. Customizing the Login Page

The recommended way to have a custom Login Page is to create one using HTML and CSS and use the [auth0js](https://auth0.com/docs/libraries/auth0js) library to authenticate the user.

#### 2. Create a Post-Login Action for Routing

The action will take action on the user’s metadata and add the target URL as a `custom claim` to the ID Token. The application will then use this claim to perform the redirect.

The action should be something like this:

```javascript
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they log in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login flow.
*/
exports.onExecutePostLogin = async (event, api) => {
  // Define a namespace for your custom claims to avoid collisions.
  const namespace = 'https://myapp.example.com/';

  // Get the destination URL from the user's metadata.
  // We'll use a fallback URL if the metadata is not set.
  const redirectTo = event.user.user_metadata.destination_url || 'https://default-app.example.com/welcome';

  // Set the destination URL as a custom claim in the ID Token.
  api.idToken.setCustomClaim(`${namespace}post_login_redirect_url`, redirectTo);
};

```

#### 3. Handle the Redirection in Your Application

When a user is sent back to your application’s `/callback` endpoint after logging in, your code needs to:

1. Process the authentication result and parse the ID Token.
2. Look for the custom claim (e.g., `https://myapp.example.com/post_login_redirect_url`).
3. Perform a server-side redirect to the URL provided in the claim.

The application that initiates the login will receive the token, inspect the claim, and can then decide to redirect the user to a completely different application if needed. For your use case, you might consider having a single, lightweight “portal” or “dispatcher” application that users log into initially. This app’s only job would be to inspect the token and redirect to the appropriate MVC application.

If you have any other questions, feel free to reach out!

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![mykola.revutskyi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mykola.revutskyi/32/73705_2.png) [@mykola.revutskyi](https://community.auth0.com/u/mykola.revutskyi)\
**Post date:** [August 14, 2025, 3:45pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/4 "2025-08-14T15:45:02Z")

</div>

Hi @vlad.murarasu!  
Thank you for the detailed explanation!

Just to summarize - for Universal Login to work I am required to have separate ‘dispatcher’ application, right?

that would mean I need to have at least 3 apps, ‘dispatcher’, Mvc1, Mvc2,  
is this correct?  
And there is no way to have Universal Login without ‘dispatcher’ app, right?

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [August 14, 2025, 4:28pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/5 "2025-08-14T16:28:54Z")

</div>

Hi again @mykola.revutskyi,

Having a dispatcher app was just my recommendation for the best user experience. Universal Login does not require you to use one; it will work regardless of whether you use one.

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![mykola.revutskyi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mykola.revutskyi/32/73705_2.png) [@mykola.revutskyi](https://community.auth0.com/u/mykola.revutskyi)\
**Post date:** [August 18, 2025, 8:49am UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/6 "2025-08-18T08:49:23Z")

</div>

Okay, so how can I setup auth0 to have single url for Universal Login without ‘dispatcher’ application?

Could you please help with exact steps like it was for recommended approach?

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [August 18, 2025, 1:23pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/7 "2025-08-18T13:23:08Z")

</div>

Hi @mykola.revutskyi,

You don’t need to do anything to “share” the Universal Login page. By default, all applications in a single Auth0 tenant already use the same Universal Login page and URL. The URL is your tenant’s domain, like `https://YOUR_TENANT.auth0.com`.

The challenge isn’t sharing the page but handling the redirection after the login is complete. Without a dispatcher app, you can use the Post-Login Action I’ve shared above, but modified for your needs.

If you have any further questions, feel free to reach out!

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![mykola.revutskyi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mykola.revutskyi/32/73705_2.png) [@mykola.revutskyi](https://community.auth0.com/u/mykola.revutskyi)\
**Post date:** [August 18, 2025, 5:34pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/8 "2025-08-18T17:34:26Z")

</div>

Okay, great  
And could you please explain how it is better to handle redirection  
What are the benefits/drawbacks of using dispatcher app compared to relying on post-login?

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [August 19, 2025, 7:31pm UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/9 "2025-08-19T19:31:48Z")

</div>

Hi @mykola.revutskyi,

The **dispatcher application** pattern is generally the more robust, secure, and user-friendly approach for complex routing. It provides a better user experience and a cleaner separation of concerns. The **post-login Action redirect** is simpler to implement for basic cases but comes with significant drawbacks in user experience and security complexity.

Here is a side-by-side comparison of the benefits and drawbacks of each approach.

1. The Dispatcher App:

This involves a lightweight, central application (e.g., `login.yourapp.com`) whose primary job is to handle logins and route users.

**Benefits:**

- **Better User Experience:** Users have a single, consistent starting point for logging in. The URL in the browser bar is predictable, and browser features like the back button work as expected.
- **Stronger Security & Protocol Compliance:** This pattern strictly follows the OAuth2/OIDC redirect flow. The application that initiates the login (`state` and `nonce` parameters) is the one that receives the tokens at its callback URL. This is the cleanest and most secure way to complete the transaction.
- **Greater Flexibility:** The dispatcher app isn’t just a redirector. It can evolve into a user dashboard, a profile management page, or a place to display announcements before sending the user to their final destination.
- **Easier Debugging:** The routing logic is in your application code, which you control completely. It’s typically easier to debug application code than to trace logic through Auth0 Action logs.

**Drawbacks:**

- **More Overhead:** It requires you to create, deploy, and maintain a separate (though likely very simple) application.

1. Post-Login Action

This involves writing an Action that performs the redirection inside the Auth0 pipeline.

**Benefits:**

- **Simplicity:** The logic is contained entirely within an Auth0 Action. There is no extra application to host or maintain, making the initial setup very fast.

**Drawbacks:**

- **Jarring User Experience:** A user might click “Login” on `app-a.com`, and after authentication, suddenly find themselves on `app-b.com`. This can be confusing and feel like a broken experience. It can also break the browser’s back button behavior.
- **Configuration Brittleness:** For the redirect to work, the destination URL (e.g., the callback for App B) must be listed in the **Allowed Callback URLs** of the _originating application_ (App A). This can become confusing to manage, as you are mixing the configurations of two separate applications.

My recommendation for a production system with multiple distinct applications, **start with the dispatcher application pattern**. The initial investment in setting up a small routing app pays dividends in security, maintainability, and user experience.

If using the Post-Login Action seems easier to manage for your needs, you can go ahead and implement that for your applications instead.

If you have any further questions feel free to reach out!

Have a good one,  
Vlad

---

<div class="post-metadata">

**Author:** ![mykola.revutskyi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mykola.revutskyi/32/73705_2.png) [@mykola.revutskyi](https://community.auth0.com/u/mykola.revutskyi)\
**Post date:** [August 20, 2025, 8:45am UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/10 "2025-08-20T08:45:08Z")

</div>

Hi @vlad.murarasu  
Thank you for your patience and brilliant responses, you are a great specialist!

I got all the understanding and arguments I needed 😁

---

<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:** [September 3, 2025, 8:46am UTC](https://community.auth0.com/t/universal-login-single-universal-login-page-and-route-for-multiple-application-within-1-tenant/190614/11 "2025-09-03T08:46:01Z")

</div>

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