NuxtN
Nuxt2y ago
Nik ⚡

Getting access to cookies in middleware

Hi am building a very simple auth in Nuxt3. I am setting session cookies with jwt tokens in my login.post.ts endpoint. For the protected pages I am using a middleware, but I am struggling to get access to the cookies in the middleware.

In the login endpoint I am setting the cookie with the h3 setCookie function. Can you please help and let me know how I access the cookie in the middleware now so I can validate the JWT?

Thanks.
Was this page helpful?