Cookies are small pieces of data stored in the browser and sent with each request; sessions store data on the server, identified by a session ID cookie. Together they enable state across the stateless HTTP protocol — essential for login, carts, and preferences.
Cookies — data stored client-side
(, , [
=> () + , // day
=> , // ❗ not readable by (XSS protection)
=> , // ❗ only sent over HTTPS
=> , // ❗ CSRF protection
]);
= [] ?? ;
