Cross-Domain sharing state in microservice architecture

331 Views Asked by At

At the moment there is a project working on the microservice architecture. Between the frontends, you need to transfer some state and save it without rebooting the main page and redirects between different domains.

For example: when you first visit the site domain1.com, a popup appears with a confirmation of the use of cookies on the page. When the user agrees with the conditions, the cookie is stored on the shared domain3.com resource. When visiting the site domain2.com, this popup should not appear, because the user has already agreed to these terms on domain1.com. It looks something like this:

Example scheme:
Example scheme

It was decided to use iFrame to save cookies on another domain. At testing it was found out, that the given approach does not work in browser Safari and in incognito mode of browsers IE, Firefox. In doing so, it works great in chrome.

We know that Safari security policy forbids pages to save cookies through iFrame, until the page where the cookie is saved will not be visited personally by the user and this is partially solved by calling window.popup but this solution looks too toxic and besides it is now not working correctly in the version of Safari 11.2. Also, we tried to save the data in the localStorage, but if the cookies were saved through iFrame, then the same actions with localStorage do not work anymore.

Example with code is represented in the github.

Thanks in advance for answers.

0

There are 0 best solutions below