What is Cookie?

A small note the browser stores and sends back with every request, often used to remember who is signed in.

Where Cookie goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • The life of a click · 4 minutes · Pro

    Logged out after an hour

    Users fill in a long form, press Save, and get 'Unauthorized'. It always happens about an hour after they signed in.

    Why do my users get logged out after an hour?

    Access tokens are short-lived, often about an hour, and must be renewed with a refresh token. If nothing refreshes the session before requests, especially on server-rendered pages that cannot set cookies, users see 'Unauthorized'. Refresh the session in code that runs before each request.

    Read the fix
Request
A message your browser (or any program) sends to a server asking for something: 'give me invoice 105' or 'save this profile'.
Session
The app's memory that you are signed in, kept for a while so you don't log in on every page.
Token
A temporary pass that proves who you are. Access tokens expire quickly; a refresh token quietly gets a new one.
Authentication
Checking who someone is, usually by signing in.
Middleware / proxy
Code that runs before every page loads, often to redirect signed-out visitors. Useful, but not enough on its own.

All 62 terms in the glossary

Before you go

Get the next trail by email

Five short lessons on what breaks in apps built with AI and how to check yours, then one email each time a new trail ships. Unsubscribe in one click.