# Cookies
Cookies are used to store session identifiers or user preferences. Actix Web allows you to read cookies easily from incoming requests.
#Accessing Cookies
You can access cookies by extracting the HttpRequest and calling the .cookie() method.
code_blocksrust
use actix_web::{get, HttpRequest, HttpResponse};
#[get("/")]
async fn index(req: HttpRequest) -> HttpResponse {
if let Some(cookie) = req.cookie("session_id") {
HttpResponse::Ok().body(format!("Your session: {}", cookie.value()))
} else {
HttpResponse::Unauthorized().body("No session found")
}
}Actix Web uses the cookie crate under the hood, so you have access to a robust API for parsing and verifying cookies.