Skip to Content
Platform.Ontology

Session cookies and tokens

The cookie or token that keeps a person signed in between pages.

Works without askingSign in and identitySession securityWeb browsersWhen you are signed inWhile you use it

In one line

Can keep you signed in between pages with a small ID stored in your browser

The cookie or token that keeps a person signed in between pages.

A random session ID (OWASP: at least 64 bits of entropy) ties each request to an account. Whoever holds it is the person. Timeouts are 2 to 5 minutes idle for high risk apps and up to 30 minutes for low risk, per OWASP.

What it can and can't do

What the user does: Nothing extra. It starts when you sign in and continues as you click around

It can

  • Remember who you are on every page you open until you sign out or it times out
  • Keep items in your cart or settings tied to your signed in session
  • Sign you out automatically after a set time, often 2 to 30 minutes of no activity
  • Treat anyone who holds that ID as you

It cannot

  • Know who you are after the session ends or you clear cookies
  • Follow you onto other sites; the ID belongs to this site
  • Show your password; only a random session ID is stored
  • Stay valid after you sign out on a well built site

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported12008-12-11:Standard in every browser
EdgeSupported1Not listed:Standard in every browser
FirefoxSupported12004-11-09:Standard in every browser
SafariSupported12003-06-23:Standard in every browser
Safari on iPhoneSupported12007-06-29:Standard in every browser
Chrome on AndroidSupported1Not listed:Standard in every browser
Samsung InternetSupported12013-04-27:Standard in every browser

How a site asks for it

APISet-Cookie: sid=...; HttpOnly; Secure; SameSite=Lax; __Host- prefix
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsSession until browser close, or persistent up to 400 days. Idle and absolute server timeouts apply
How to take it backClear site data, browser privacy settings
Inside an iframeNot listed

Data you get

What comes back: Session ID
Shape: string
How often: per request

FieldTypeUnitRangePrecision
entropyintegerbitsat least 64, 128 recommendedexact

Technical limits

  • HttpOnly hides it from scripts
  • __Host- prefix forces Secure, Path=/ and no Domain
  • Chrome caps lifetime at 400 days
  • Browser restore can bring session cookies back after restart

The story

What it is

A small token that keeps you signed in as you move from page to page.

For you

You sign in once and stay signed in while you click around, add things to a cart or play a web game. You never see the token. If it times out you are asked to sign in again.

For makers

Every logged in site needs a way to remember who you are between clicks. Makers also use the same token to count active users, limit abuse, and tie purchases and saved progress to the right account.

Where you see it

TypeExampleApps
gamesA browser game keeps a player signed in so a multiplayer match, friends list and in game purchases all point to the same account.Roblox, Wordle (NYT), Poki
shoppingA cart stays full while a shopper browses for an hour, and the checkout page knows who they are.Amazon, Etsy
bankingA bank signs a person out after a few minutes of quiet and ties each session to one browser to block hijacking.None named
videoA video call web app keeps the host signed in while a meeting runs, so screen sharing and chat stay linked to their account.Google Meet, Zoom
securityA fraud engine watches for a session token suddenly used from a different country or device, which hints at theft.None named
analyticsA product team counts how many signed in people are active each day by counting session tokens.Google Analytics
creativeA design web app keeps every browser tab signed in so edits sync live to a teammate's view.Figma, Canva

Risks

  • Stolen token equals stolen account
  • Long sessions on shared computers

Good uses and abuse

Legitimate uses

  • Keeping a person signed in

Known abuse

  • Session theft and fixation

Scores

ScoreValueMeaning
Sensitivity5 of 5How revealing the data is
Utility5 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2020-02, Chrome 80: SameSite=Lax default reduced CSRF

Sources

How well checked: Based on official documentation.

On this page