-
Hi, I'm new to Nuxt 3 and SSR as a whole and I'm wondering if I'm doing something wrong. My current setup is a frontend with Nuxt 3 (SSR) and a backend API using fastify. Now, I'm using JWT + Refresh tokens for authentication, and I'm seeing unexpected behavior. When I make a POST call to const result = await $fetch.raw('/users/login', {
baseURL: useRuntimeConfig().public.apiBase,
method: 'POST',
body: { email, password }
})
console.log(Array.from(result.headers.keys())) I'm using In Chrome Network's tab, I can see the request being made, and the Set-Cookie header is visible. However, under Application > Cookies, the list is empty. I tried with I even tried making a temporary GET endpoint with a dummy cookie: when visiting the endpoint directly with my browser, the cookie is correctly set, and sent with every request. However, with Nuxt, the cookie is also sort of "ignored". What am I doing wrong ? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well, looks like I was missing |
Beta Was this translation helpful? Give feedback.
Well, looks like I was missing
credentials: 'include'
in my $fetch options.No clue if this has an impact with
ssr: true
, so keeping it open for now. Does Nitro do anything with that ? Am I at risk of exposing cookies to all my users ?