react_jwt_auth
react_jwt_auth copied to clipboard
Store auth info localStorage to persist state on refresh page
store auth info in local storage at login then update context by updating state using useEffect in AuthProvider.js
No, you shouldn't store the JWTs in the localStorage, cookies provides an additional security, and the simplicity of protecting against CSRF with modern web frameworks. Web Storage (localStorage/sessionStorage) is vulnerable to XSS, has a larger attack surface area, and can impact all application users on a successful attack. In any case you are vulnerable to some kind of attack based on this choice (CSRF or XSS). React helps prevent, but to avoid most vulnerabilities make the Front-End and Back-End communicate via HTTPS.
How can i get or store user data after login, for example, display a message like Hello Admin after login