Good day!
There is a landing page on which there is a login and password entry form, for example, domain.com. And there is a SPA application on app.domain.com, which is redirected after login on the landing page.
How to make authentication via API between domain and subdomain more secretly, so that after a redirect, do not worry about the token?
Option 1. Log in to domain.com and pass the received token as a GET parameter - not very important, because It easily glows in the browser bar, and in principle everywhere in the request.
Option 2. Set cookies token = mytoken in the domain and take them in the subdomain. I doubt a bit that this is also security. Because for any random xss, the token can be stolen (of course, you need to make sure that there is no xss, but still, there is a chance).
Tell me, please, a more reliable way.
Thank!