Goku ごくう
Issue with JWT auth in Nuxt 3 SSR
I am unable to find the resources, but it seems that Pinia cannot be accessed during server-side rendering (SSR), so you will need to create a plugin. I am currently using
auth.server.ts
under plugins. You can use functions such as useRequestEvent()
, appendResponseHeader
, and parseCookies
from "h3". You can utilize cookies with these functions. Instead of Pinia, I am using useState
because it is the safest way for Nuxt payloads, and it works on both the server and client sides.5 replies