I heard that JWT tokens are recommended to be stored as follows:
access_token
in application memory (as the example I gave - closure) in Cookie entry (Http only)
access_token is stored in
localStorage and is used to check authorization status:
isLoggedIn: state => !!state.token
In Vuex
refresh_token Stored in cookies %
P粉4640820612024-03-27 09:29:43
Keeping the token in a closure will depend on the exact implementation you use, and is a bit difficult to demonstrate without any sample code. Maybe you could post part of the code where you get the access token and where you use it?
However, to store the token in memory, it does not have to be a closure. You can even keep it in vue