I found out that Inertia if not invalidating the session until an additional refresh or addtional redirect.
I have this in my controller but it doesn't seem to be enough for inertia to let go:
public function destroy(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Redirect::route('home');
}
What actually happens is the logout appears to have completed, and the redirect is shown, however it seems to be a modal over the top of the previous session. a refresh will release and take me to the login page, since only an authenticated user can see the dashboard.
So although I can see the page "home" it is not my actual URI location.
I created a simple workaround since I could not solve the logout redirect problem.
Created a Vue/Inertia page that timed out in ½ second.
export default {
created(){
setTimeout(function(){ window.location = "/"; },500);
},
}
And in my controller, this:
public function destroy(Request $request)
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Inertia::render('Auth/Logout');
}
Now all Dusk tests passes.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community