Staying Signed In

Staying Signed In: Sessions and Cookies, Tokens: Signing In with a JWT.

Updated

  1. Sessions and Cookies (Journeyman): A session keeps a student signed in the way a coat check does, with the record on the server and only a random ticket in the browser's cookie, and express-session sets it up with the HttpOnly, Secure and SameSite flags; it's the simpler choice for one website on its own server.
  2. Tokens: Signing In with a JWT (Journeyman): A JWT is a signed token the server hands out at sign-in and each request sends back in an Authorization Bearer header; jsonwebtoken's sign and verify make and check it, anyone can read its payload, and it fits APIs that apps and other servers call.