Hi Guys,
I need some advise on Sessions.
I mount an Lumen API that handle multiple Front Application.
In some of these Front App, some is handled with laravel.
I want to work on user connections (so Sessions).
I've made some research on Sessions. 5 Possibilities :
File
Database
Cookies
memcached
Array
I got two questions :
Who is best to handle sessions ? APIs or Web App
What is your adivse concerning these possibilities ?
My advise is for token based API : https://laravel.com/docs/5.6/passport.
So on login, backend gets email + password and if ok, returns an access_token for this user and that token is used to keep the user logged in.
This way, no cookies have to be send on every request to the API, and you can revoke tokens if / when needed.
You can go for File / DB / Memcached sessions, it doesnt really make a big difference in speed.... DB Sessions are ofcourse more easily manageable (remove a current session for instance)