Are you redirecting back to the same page at the end of the login process? Are you using something like preserveState when you're posting the login request?
Jun 30, 2025
3
Level 4
No user after login redirect, and user still available after logout redirect
So normally, in the AuthenticatedSessionController, on store and destroy I have something like this at the end: return redirect(route(...)).
I hand over the user using HandleInertiaRequests.php. Problem: After login, user is null in my react components. After a page refresh, the user is there. And after logout, user is still there, until another page refresh.
What's going on?
I did find a solution, but it's hacky: return response('', 409)->header('X-Inertia-Location', $route); after login/logout, instead of a regular redirect.
Please or to participate in this conversation.