Can I share local storage between domain and sub-domain?

Hello,
I hope to design 2 projects where one is the domain and the other is a sub-domain. I want to share a tokens between a domain and sub-domain for authentication purposes
mydomain.com as the main page with login screen

Then have a separate project with a sub domain.

Can I use Local storage or similar way to easily share this token data?

Nope, local storage is bound to a domain. There is a workaround but it’s not pretty.

Thanks for that one.
The main reasoning to use sub-domains as separate projects is to reduce the risk of affecting another part of the website when working on different parts.
So my thoughts are:
When a user logs in at mydomain.com and then moves to academy.mydomain.com, essential information will be passed via a query string. The sub-domain will then call a Xano API to retrieve any additional data it needs and store it in local storage.
I think that will do the job for my requirements
Hope that makes sense!

1 Like