Currently, I am working on an application using vue.js and vuex that authenticates to a JSON API server through JWT tokens. The challenge I'm facing is determining the best method for storing the JWT token securely.
If I choose to store the token in the vuex store, it unfortunately gets cleared after the page is refreshed, leading to users needing to log in again, which is not an ideal user experience.
Alternatively, if I opt to store the JWT token in local storage within the browser, it becomes deprecated before the next login session, causing confusion among components relying on the authentication token. This ongoing issue has left me unsure of how best to address it.
I would greatly appreciate any insights or suggestions you may have on this matter. Thank you!