How do cookies, sessions and tokens differ?

2 stars Asked often.

In one or two sentences
A cookie is a small value the browser stores and sends with requests. A session keeps login state on the server. A token proves identity with a signed value, so the server keeps no state.

Think of your own answer first

Say it out loud, or type it below. What you type never leaves this device.

Follow-up questions

These are likely next questions from an interviewer. Think of your answer first, then press the button.

  1. 1 / 3

    How do XSS and CSRF differ?

Sources checked