Hello,
I am setting up a B2B application where customer applications are hosted on their own subdomain (e.g. companyA.myapp.com
, companyB.myapp.com
)
These are currently treated as different applications and users navigate to their subdomain, get kicked to the Auth0 login flow, then get redirected back to the original subdomain.
I would like to move this to a “universal” login page where users can go to any subdomain and login with their organization, user, and password, then get redirected to their subdomain.
I’ve gotten started with organizations but I can’t figure out how to do the redirect.
I’m using the “New Universal Login Experience” and this library react-oidc-context - npm in my application like so:
<AuthProvider
authority={config.oauth.authority}
client_id={config.oauth.clientId}
redirect_uri={window.location.origin}
...
>
<BrowserRouter>
<Main />
</BrowserRouter>
</AuthProvider>
Now when the user goes to log in, they are first prompted for their organization, then get directed to their organization-specific login page.
But after logging in, they get redirected back to the original redirect_uri
. For example:
-
UserA@companyA.org
navigates tocompanyB.myapp.com
-
UserA@companyA.org
gets redirected to Auth0 for login -
UserA@companyA.org
enters in organizationcompanyA
-
UserA@companyA.org
gets redirected to the organization-specific login page -
UserA@companyA.org
enters in their credentials -
UserA@companyA.org
gets redirected back tocompanyB.myapp.com
The desired behavior is to have step 6 redirect the user to companyA.myapp.com
.
I’ve tried using actions to redirect the user (Redirect with Actions) but this doesn’t accomplish this since it only delays the inevitable redirect back to the original redirect_uri
.
Is there a way to get this to work?