Answer the question
In order to leave comments, you need to log in
How to authorize in SPA if the backend is on a different domain?
There are dom.com and api.dom.com - frontend and backend, respectively.
With CRUD, everything is clear and simple with this application construction.
But what about authorization?
When everything lies on the same domain, then a session is created during authorization and a dance starts from it.
Answer the question
In order to leave comments, you need to log in
The authorization cookie must be available for both domains
In your case - the domain of the cookie must be ".dom.com" - the dot at the beginning is required
The session itself must be stored in a shared storage that both the front-end and back-end have access to (such memkesh or radish).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question