Open agracia-foticos opened 2 months ago
Could you please elaborate a bit? What are you trying to achieve? Some code examples would be nice to understand the problem, thanks
We manage a session with https://h3.unjs.io/examples/handle-session outside nuxt-auth.
This session its bassed on cookies, this session contains a field called createdAt, this value we must checked in JWT session, because its expiration session of auth.
This field can be changed, this is the reason because we want read it in JWT function, but NuxtAuthHandler doesnt have access to :
Can you provide at least a minimal reproduction? I have hard time following your usecase. You can use CredentialsProvider
with hardcoded credentials similar to playground-authjs
:
https://github.com/sidebase/nuxt-auth/blob/main/playground-authjs/server/api/auth/%5B...%5D.ts
You can base it off playground-authjs
to save some time or from one of the templates below (from bot comment).
NuxtAuthHandler
normally works according to Authjs flow: https://authjs.dev/getting-started/installation#configure
Hello 👋
Please provide a reproduction for this issue 🙏
https://stackblitz.com/edit/nuxt-starter-embl4u @phoenix-ru here you are a reproduction, but we cant test it because stackblitz are very slow compiling
you can see in plugins/01.session.ts we initialize the H3 cookie session.
In server/routes/api/session.get.ts we retreive this H3 cookie session.
In server/api/auth/[...].ts in JWT validation, we want to check this H3 cookie session, but returns blank, not the session created in plugin, because in NuxtAuthHandler seems that cookies arent accesible
Tried to check the reproduction but you're right - Stackblitz is slow - or support of Stackblitz in Nuxt is broken. Unfortunately, need to de-prioritize in favor of #883
@phoenix-ru don't worry, prioritize #883, We can advance our development on the other hand, this issue is not a priority. In a few days I will contact you again
Environment
Linux
v22.7.0
3.13.1
3.13.1
2.9.7
yarn@4.3.1
-
-
-
-
Reproduction
we cannot reproduction
Describe the bug
We are trying to use useRequestEvent and useRequestHeaders to access the request cookies but they are not available.
Also we try to access $fetch('/api/session', {method:'GET'}) (this is an access to H3 session) but the cookies not are sending.
There is any option to send cookies to NuxtAuthHandler?
Additional context
No response
Logs
No response