# SSO across multiple SPA apps

**URL:** <https://community.auth0.com/t/sso-across-multiple-spa-apps/110680>\
**Category:** Get Help\
**Tags:** authentication-sessions, sessions\
**Created:** [July 6, 2023, 1:34pm UTC](https://community.auth0.com/t/sso-across-multiple-spa-apps/110680 "2023-07-06T13:34:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![llai](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/llai/32/43978_2.png) [@llai](https://community.auth0.com/u/llai)\
**Post date:** [July 6, 2023, 1:34pm UTC](https://community.auth0.com/t/sso-across-multiple-spa-apps/110680/1 "2023-07-06T13:34:34Z")

</div>

Hello! I am having trouble with SSO across 2 of my SPA apps.

[app1.domain1.com](http://app1.domain1.com) - has private & public routes  
[app2.domain2.com](http://app2.domain2.com) - has all private routes

My apps are currently on different top level domains and they each have their own auth0 application. When I log into app2 and navigate to app1 I am not automatically logged in when calling checkSession (from auth0-spa-js lib).

I noticed when I log into app2 I get an `auth0.[clientId].isAuthenticated` cookie. Does this cookie need to be present on app1 when it loads to automatically be logged in? If so, does this mean the apps need to be on the same top level domain so I can use a cookieDomain of `.domain1.com.` And do I need to share a single auth0 application across both apps so the apps use the same `auth0.[clientId].isAuthenticated` cookie?

Thank you

---

<div class="post-metadata">

**Author:** ![llai](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/llai/32/43978_2.png) [@llai](https://community.auth0.com/u/llai)\
**Post date:** [July 11, 2023, 3:46am UTC](https://community.auth0.com/t/sso-across-multiple-spa-apps/110680/2 "2023-07-11T03:46:32Z")

</div>

I ended up putting both apps on the same top level domain and have both apps using the same auth0 application (so the apps share the same clientId). So my example is now

[app1.domain1.com](http://app1.domain1.com) - has private & public routes  
[app2.domain1.com](http://app2.domain1.com) - has all private routes

With this setup I was able to use `.domain1.com` as the `cookieDomain` parameter I pass into the auth0-spa-js lib. Both apps now can share the `auth0.[clientId].isAuthenticated` cookie.

I’m not sure if this is the correct approach, but it seems to work for my use case.

---

<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:** [July 25, 2023, 3:47am UTC](https://community.auth0.com/t/sso-across-multiple-spa-apps/110680/3 "2023-07-25T03:47:10Z")

</div>

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