Skip to main content

logout

Function logout 

Source
pub async fn logout(session: &Session) -> Result<(), AppError>
Expand description

Logs the current user out (Laravel’s Auth::logout()). Flushes the entire session, not just the auth key - a clean logout should also invalidate anything else tied to that session (e.g. the CSRF token), not leave it half-authenticated. Operates on the default ("web") guard; for a named second guard, use logout_for instead, which clears only that guard’s own slot and leaves the rest of the session - including any other guard’s login state - untouched.