Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
zacksinclair
· 6y ago · 0 comments
Why not store short lived token in a cookie as well?
Comments
[–]
poxrud
6y ago
Because then you can be vulnerable to csrf attack. For example if someone tricks you into clicking www.mysite.com/api/delete-account
[–]
anaxag0ras
6y ago
CSRF attacks can be prevented using same-site policy with cookies.
[–]
poxrud
6y ago
That is true but it will not protect against all forms of CSRF, for example you'll be vulnerable if you have user generated content that's not sanitized properly. On the refresh_token cookie I have sameSite and httpOnly set.