pub async fn logout(
__arg0: State<DB>,
__arg1: Json<RefreshTokenRequest>,
) -> (StatusCode, Json<AuthTokenResponse>)Expand description
Handles user logout requests This endpoint allows clients to log out by revoking the provided refresh token. It removes the refresh token from the database, effectively invalidating it and preventing any further use for obtaining new access tokens.
§Arguments
State(db)- Shared state containing the database connection and JWT configuration (JWT config is not used in this handler)Json(payload)- The logout request payload containing the refresh token to be revoked
§Returns
(StatusCode, Json<AuthResponse>)- The HTTP status code and JSON response indicating success or failure of the logout operation
§Error
StatusCode::INTERNAL_SERVER_ERROR- If there is an error revoking the refresh token
§Example
let payload = RefreshTokenRequest {
refresh_token: "valid_refresh_token".to_string(),
};