How to share session between an angular app and a nextjs app at the same domain

We have a nextjs app, and an angular app. The nextjs app is served from our main domain, and so is the angular app. The angular app is served when the user goes to a certain path, and this is handled via nginx. So imagine

https://maindomain.com serves the nextjs app
https://maindomain.com/angular serves the angular app, which resides in our public/angular folder (this is possible as angular is compiled and served statically)

Both of these apps have auth0, and we would like them to share a session, i.e. when the user logs into nextjs, the angular uses that session, and vice-versa. Is this possible? Right now we are using the angular app to login, and when we navigate back to the next app, it does not reflect the login state. Is it possible that they share the same login cookie if configured properly?

Since they are initialized in different ways, with different requirements, it is not easy to tell if this is just not possible, or we are initializing things in correctly.

thanks

Hi @jon_s ,

If you’re using New Universal Login and you configure these apps in one Auth0 Tenant, SSO will work straight out the box.
Ensure you follow our quickstart guides to get the right configurations for the different app implementations.
You can configure the Callback URLs in each application to make sure users are redirected to the right app after authentication.

FYI here is a good blog post explaining more about SSO and to help understand how this works with Auth0.

Hope this helps, thanks!

1 Like