[Vuejs]-What is the best way to get access token from cookie and save it in store in Nuxt3?

1👍

To retrive the access token from the cookie – useCookie

const token = useCookie('access-token')

Now you can read cookie like this

const accessToken = token.value;

If you need it to happen on every page, use your App.vue for example to init your custom store and Pinia actions to change the value to your needs.

Leave a comment