Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

plweller3's avatar

Laravel 5.4 session ID changes again *after* the Login event fires

Greetings All,

I get why the session ID changes in SessionGuard->updateSession() after the credentials are validated. And I get why the Login event is fired right after that in SessionGuard->login(). That all seems consistent with previous versions.

However, the session is again regenerated in the AuthenticatesUsers trait method SendLoginResponse(), which is called after the Login event fired.

This has the unfortunate effect of making the application session different than what one might have captured by listening to Login.

I'm curious why the regeneration occurs again in SendLoginResponse(), and is it even possible to capture the correct session id during login with an event listener, or in 5.4 must we override one of the methods in AuthenticatesUsers trait?

0 likes
0 replies

Please or to participate in this conversation.