Check the cookie security settings behind your sign-in flow
A session cookie lets a website recognize a signed-in browser. Its attributes determine how the browser sends it and whether page scripts can read it.
Choose Secure and HttpOnly cookie settings
Secure
Send the cookie over HTTPS. This attribute alone doesn't prevent scripts from reading it.
HttpOnly
Keep the cookie out of JavaScript cookie APIs.
The cookie reference defines each attribute. Choose them to suit what the cookie does.

Choose SameSite cookie settings that keep sign-in working
With
Strict, the browser sends the cookie only on same-site requests.Laxalso sends it on certain top-level cross-site navigations.Noneallows cross-site sending and requiresSecure.Test sign-in, return links and intended embeds before tightening the setting.
Use cookie name prefixes to lock a cookie to one host
Omitting
Domainmakes a cookie host-only. In supporting browsers, the__Host-name prefix requiresSecure,Path=/and noDomainattribute. The__Secure-prefix requires a secure origin andSecure, but doesn't impose that same host-only scope.Where browsers support cookie prefixes, they enforce those extra requirements. Prefixes don't replace the rest of the cookie's configuration.
Frequently asked questions
Does an HttpOnly cookie stop cross-site scripting?
No. HttpOnly keeps page scripts from reading the cookie, but the browser still attaches it to requests those scripts make. Treat script injection as a separate problem.
Review cross-site reads alongside cookie security
Website security
Catch leaked API keys and exposed files before someone uses them against you.
CORS
Review cross-site read permissions without opening private responses to every origin.
Storing auth tokens: localStorage or cookies
Choose token storage based on script access and requests that carry cookies.
Cookie banner requirements
Work out when a banner needs consent controls and when a consent exception may apply.