Server-side session (Cookie Session)
Built into the frameworkAfter login the server records "this person is logged in" and gives the browser only an ID (kept in a cookie); each later request looks up the record by that ID.
Best forServer-rendered sites or same-domain frontend/backend websites and admin systems.
Avoid whenThe main clients are mini-programs or native apps, or the backend will be split into many independent services.
To log someone out immediately, just delete the record on the server
Browsers send cookies automatically, making web apps simplest to implement
Built into nearly every framework, with fairly complete secure defaults
The server must store sessions, and with multiple servers you need shared storage (such as Redis)
Mini-programs and mobile apps support cookies less naturally than browsers
Cross-domain use needs extra configuration and is easy to trip over