I'm trying to understand, how can I protect my SPA.
Application based on microservices, and contains modules which host on couple server. These modules works like SPA e.g. page with accounting module is a separate application. All of modules are hosted in main application in iframe component.
I create communication between rely on send message by postMessage() Of course, I also check the origin in each action. I want to pass data(also sensitive) between iframe and main application.
I came up with a diagram for developers:
Of course, I don't know how to create a strong authentication module for this case. Maybe all you need to do is provide the secret key inside the postMessage request. Maybe it's more complicated than I think.
I will add: I want to provide an interface to create your own modules (embedded spa) for developers. This may be a similar solution to google maps. In this case, maybe additional secure isn't necessary - I don't know? I have problem with understanding.