laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.43k stars 10.99k forks source link

How to define session with multi auth #18222

Closed vinacms closed 7 years ago

vinacms commented 7 years ago

Description:

I use multi auth. I login /admin and /home then logout one in two. It logout both.

I want config /admin - 1 session and /home - 1 another session.

alexsoft commented 7 years ago

@SieuNT I think this is because default out-of-box logout method regenerates session id and that's why you are logged out in all guards. https://github.com/laravel/framework/blob/5.4/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php#L159

So I guess you will need to write you custom logout method.

cjaoude commented 7 years ago

maybe it's just me, but seems odd to be logged in to both in the first place. kind of defeats the point. use roles/privileges instead if that is the case

alexsoft commented 7 years ago

@cjaoude I don't. For example in one of my projects I use a second guard for reserving my personal account while I'm impersonating other user. Very handy, I think

Fenzland commented 7 years ago

I think to regenerate session when logout is a bad design. For session guards, it cause 'logout one, logout all' bug. For other guards, we don't need do anything with session when logout.