0👍
localStorage object is under window
, which only exists on the client side.
I have used cookie-universal-nuxt in Nuxt 2 to share the cookies between server and client for auth purposes.
- [Vuejs]-Am I doing something wrong in this API call?
- [Vuejs]-Vue.js 2 Reusing component with two different parent variables
0👍
As @justanotherpeter mentioned, you can only use localStorage on the client side. Alternatively, you can use cookies for your authentication. Nuxt 3 has useCookie composable.
Source:stackexchange.com