3

I have 2 applications, the Dashboard and the Users. Each app requires users to be authenticated. The problem is that Users App is going to be served on a subdomain. For example the Dashboard app will be served at www.myapp.com and Users App will be served at www.users.myapp.com. Both apps should look for the same JTW stored in the local storage.

I found an article about cross domain local storage use localStorage across subdomains, but how can I test this? If I run both apps together they run on different ports, the first one runs on localhost:3000 and the other on localhost:3001.

The idea is pretty much how google works, once you log in to google.com then you can go to mail.google.com etc.

  • 1
    Is your question simply “*How can I simulate subdomains when testing with localhost?*”? If so, there’s a good answer on [this question](https://stackoverflow.com/q/19016553/1813169). – MTCoster Dec 28 '18 at 20:38
  • try changing /etc/hosts (the path is different on windows) – smnbbrv Dec 28 '18 at 20:40
  • @Phil That question is explicitly mentioned in the question because OP wants to know how to test the solutions in it. Not a dupe. – MTCoster Dec 28 '18 at 20:42
  • Finally this library https://github.com/zendesk/cross-storage did the work. It lets you define the origins that you want to share with the local storage. So it works on localhost too. – Giorgos Karyofyllis Dec 28 '18 at 21:17

0 Answers0