D
D
Denis Bukreev2017-05-21 14:57:28
Laravel
Denis Bukreev, 2017-05-21 14:57:28

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

2 answer(s)
R
RidgeA, 2017-05-21
@denisbookreev

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).

A
Anton, 2017-05-21
@Ooos

Read about CORS, the server must support their requests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question