Hello Auth0 Community,
I have set up a single Auth0 tenant that serves two distinct web applications. These applications are hosted on different domains, let’s say app1.com
and app2.com
.
I aim to implement a Universal Login flow using a third URL (let’s say app.com
). The desired flow is:
- User visits
app.com
. - User is redirected to the Auth0 Universal Login Page.
- After authentication, based on certain criteria (either the incoming application or user’s
app_metadata
), the user is directed to eitherapp1.com
orapp2.com
. - The chosen application (
app1.com
orapp2.com
) completes the authentication flow, and the user can then interact with it as an authenticated user.
Currently, using Next.js 13 and Auth0, I’ve been able to achieve the redirection using an Auth0 Action (Step 4). This redirects users to app1.com/api/auth/callback
or app2.com/api/auth/callback
successfully.
However, I’m having difficulty with the last part of the flow (Step 5). I tried using the “state” query parameter to conclude the authentication process, but I can’t discern what information I need to send/receive to complete the authentication and maintain the user’s authenticated state on app1.com
or app2.com
.
Could anyone provide insights or guidance on how to successfully finalize this authentication flow?
Thank you in advance!