Answer the question
In order to leave comments, you need to log in
Where is it better to store the flag - in cookies or in localstorage?
authenticated: false
For example, the SPA application
flag . Where and why is it better to store such data?
Now I have cookies. I think I can put it in storage?
Answer the question
In order to leave comments, you need to log in
If you have one domain - in localStorage. It makes no sense to carry this cookie between requests. If there are subdomains - in the cookie, because. you simply will not rummage around localStorage between domains in any way.
Even better - in the state of your SPA. Why do you need a cookie/storage flag to indicate that the user is authorized? Well, get it when you load your SPA and let it be stored in RAM. Moreover, you will get reactivity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question