'Client-side jwt token storage
I need advice, what is the best way to store a JWT token? Should we store in cookies or storages? But with the CSRF flaw and xss attacks I have a doubt. I'm still in training and working on a year-end project. Or the best is to store the jwt token in a variable in a store. I developed the application in nodejs express js for the back and in react for the frontend. Thanks in advance for your advice.
Solution 1:[1]
I use cookies, they are easily able to be accessed server side and can have an expiration date.
Take a look at this post: Local Storage vs Cookies
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jack Lankford |