# Auth0 domain cookie session issue with subdomains

**URL:** <https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639>\
**Category:** Get Help\
**Tags:** application, sso\
**Created:** [May 10, 2023, 3:34pm UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639 "2023-05-10T15:34:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlosn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlosn/32/46943_2.png) [@carlosn](https://community.auth0.com/u/carlosn)\
**Post date:** [May 10, 2023, 3:34pm UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639/1 "2023-05-10T15:34:08Z")

</div>

Hello,

We are trying to setup SSO authentication in our website, we have a particular escenario where we use the same app but with different access sub domains, like this:

Domain: [example.com](http://example.com)

Site A → [a.example.com](http://a.example.com)

Site B → [b.example.com](http://b.example.com) → proxy to [a.example.com/path](http://a.example.com/path)

We want to authenticate an user in [a.example.com](http://a.example.com) and reuse the same session in all subdomains.

However we are struggling with this setup because for some reason the user session information is lost when we change of subdomain, example:

Site A → [a.example.com](http://a.example.com): User is logged and session is created

Site B → [b.example.com](http://b.example.com): User change to site B and user information is lost (domain session cookie is still present)

Site A → [a.example.com](http://a.example.com): User return to site A and user information is available again.

We added the cookie domain .example.com in our frontend client but still we have some issues when the app tries to access the user information in a different subdomain.

Has anyone done something similar?

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/phi1ipp/32/40616_2.png) [@phi1ipp](https://community.auth0.com/u/phi1ipp)\
**Post date:** [May 11, 2023, 2:16am UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639/2 "2023-05-11T02:16:32Z")

</div>

what is the cookie `domain` value?

---

<div class="post-metadata">

**Author:** ![carlosn](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/carlosn/32/46943_2.png) [@carlosn](https://community.auth0.com/u/carlosn)\
**Post date:** [May 16, 2023, 7:45pm UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639/3 "2023-05-16T19:45:34Z")

</div>

The cookie domain was like this .example.com, however, we could figure out what was the issue, it was related to some missing config in the frontend client and redirect rules in the loadbalancer.

Thanks!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 17, 2023, 12:17am UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639/4 "2023-05-17T00:17:39Z")

</div>

Hey @carlosn glad you hear you were able to get this sorted, and thanks for following up with the community!

---

<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:** [May 31, 2023, 12:17am UTC](https://community.auth0.com/t/auth0-domain-cookie-session-issue-with-subdomains/106639/5 "2023-05-31T00:17:56Z")

</div>

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