Answer the question
In order to leave comments, you need to log in
Is localStorage a better choice than cookies?
Good day.
There is a need to store a token that will only be used on the client. Only the client will receive it too. At first I thought to write it to the cookie, but then I remembered sessionStorage. Cookies are transmitted along with headers, but web storage is not, therefore, an attacker will be able to steal data from the storage only through xss or direct access to the computer, which is impossible with the proper approach. Or a virus.
Is web storage more secure than cookies? Is it a good practice when creating a SPA to write some kind of authorization data in the store, and not in cookies (public key, api token, etc.)?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question