Laravel Auth session valid across multiple devices when backend is API for SPA?

I have an architectural dilemma about how to implement authentication sessions that will be valid across multiple devices. This system of ours is currently implemented as an API, which means that the front-end is not hosted in Laravel, but makes requests to a different subdomain where Laravel is located.

Currently, every login creates a new cookie. Therefore, if the user previously logged into her browser on the desktop and she now logs in with her mobile device - then the desktop session cookie has expired. And the desktop browser doesn't know this before when the user loads this single page app and the front-end fires an initial API call to check if the session is valid.

What would be the correct way to solve this problem?

+3


source to share





All Articles