When login is successful and redirect to homepage, I try to logout, but de session still alive. This is logout function in Auth\LoginController:
public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->invalidate();
return $this->loggedOut($request) ?: redirect('klantportaal/login');
}
I use login and logout for custom guard:
/**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard('crvskp');
}
@jlrdw Thanx jlrdw for response, redirect works. That is not problem, but when I go back to klantportaal/client, I can see everything, while this route is protected. The only way to remove the session is to manually removes browser data.
Dit you find a fix for this? I'm sort of in the same boat. I use Sanctum with an SPA, but no matter what I do, when refreshing the page, the session (and thus authentication) remains. I simply can't logout :(