#How do I separate logins between two different frontends sharing one Laravel API?
5 messages · Page 1 of 1 (latest)
I tried to add a function to AppServiceProvider that dynamically sets the cookie name differently for each frontend based on the origin header (they are on different subdomains). Thanks to this, when I log in on one frontend, I am not logged in on the other.
However, there is another problem: I load frontend 1, then I load frontend 2, and when I want to submit a form from frontend 1, I get a CSRF error. What can I do about this, please?
have you considered using jwt or adding a column on the session row like a "app_id" or something?
I don't really want to switch to token-based authentication because I already use cookie-based authentication in the application (as recommended in the documentation for spa).
What do you mean by app_id row?
I would prefer to have separate sessions for each subdomain without causing CSRF problems. Is there a solution for this?