search

Home  >  Q&A  >  body text

Store JWT token in closure

I heard that JWT tokens are recommended to be stored as follows:

Currently, my

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粉036800074P粉036800074284 days ago482

reply all(1)I'll reply

  • P粉464082061

    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

    reply
    0
  • Cancelreply