Hi, I am creating an application with different set of users - clients, staff and admin. Each one will have it own set of interface so a staff cannot access admin interface and so on.
I have managed to tweak Laravel for multi-auth system (https://youtu.be/iKRLrJXNN4M) but the issues which I am facing are:
Sessions - Laravel still uses the default session assignment system for logged in users so when a user is accessing the client front end the user_id is captured from user table while for admin interface the user_id is captured from the admin table. While doing so the session id remains the same when accessing the user and admin interface from the "same" browser. I noticed this while testing the system. I need to tweak Laravel to create a separate session record when a user accesses the staff/admin panel and the user interface. Any hint on how I can do this? Currently I am using separate Guards for auth check so it verifies with the correct database table.
Ideally when the user successfully logs into the admin panel a fresh session record should be created a maintained separately. I think this will fix the issue of auto switching of "user_id" in the sessions table due to same session ID.
I think this has to do with the issue above. On the login form when I select "Remember Me" for client side, it works fine but on the same browser if I choose "Remember Me" for Admin form I get a Token Mismatch error. I think that is because the session IDs are the same. If this is not the issue, let me know how I can fix this.
Thanks.
Hi Hiren, I am not sure what roles are you trying to assign to what type of user. Making a single user sign in is a must behavior for most (i guess all applications). If you say so, i believe, it must be your requirement. Middlewares might be able to help you in access management. I am not exactly able to understand your problem. If you can portray a different example it would be good. One more thing, try to maintain a single user table and define roles within it... as the application size will grow it will be easier for you to manage. cheers!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community