MediumConceptAuthentication and sessions end to end
What cookie attributes do you set for a session cookie?
What a good answer covers
HttpOnly so scripts cannot read it, Secure so it only travels over HTTPS, SameSite=Lax or Strict against CSRF, a limited Path and Domain, and a sensible expiry.
PreviousHow does a server-side session work with a cookie?Next What is the difference between SameSite Lax and Strict?