diff --git a/actix-identity/src/lib.rs b/actix-identity/src/lib.rs index aa3f98dba..5e30eb951 100644 --- a/actix-identity/src/lib.rs +++ b/actix-identity/src/lib.rs @@ -74,8 +74,10 @@ async fn login(request: HttpRequest) -> impl Responder { } #[post("/logout")] -async fn logout(user: Identity) -> impl Responder { - user.logout(); +async fn logout(user: Option) -> impl Responder { + if let Some(user) = user { + user.logout(); + } HttpResponse::Ok() } ```