Sessions vs tokens
Two main ways to remember a logged-in user:
- **Sessions*: the server keeps a record on its side and sends the browser a cookie with a random session id. Simple and secure.
- **Tokens*: the server issues a signed token the browser keeps and sends with every request. Better for APIs and mobile apps.
Express sessions need a cookie plus a store. For a simple app the in-memory store is fine; for many servers you swap in a Redis store so any server can validate the session.