-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refresh token rotation using the JWT callback does not work in app directory #7522
Comments
See: https://next-auth.js.org/configuration/nextjs#in-app-directory
Next.js docs: https://nextjs.org/docs/app/api-reference/functions/cookies Similar issue: #7025 |
Closing as mentioned above. We are working on support for this via other means (Server Action, Route Handler, and/or Middleware) in the next major version of NextAuth.js. |
It's great to hear that this will be implemented, but as raised the documentation for the current version are not clear that the token refresh won't work as expected in the app directory. Is it not worth adding a small warning on the guide? |
It's already mentioned here: https://next-auth.js.org/configuration/nextjs#in-app-directory The refresh token rotation guide purposefully does not mention App Router yet. |
What is the improvement or update you wish to see?
The app directory feature of Next.js does not allow the cookies to be updated on the server. This means that any usages of
getServerSession
that would trigger a refresh token rotation as described in the docs would not set the new access token / refresh token / expires time in the next-auth cooke.This should be made clear in the documentation.
Is there any context that might help us understand?
N/A
Does the docs page already exist? Please link to it.
https://authjs.dev/guides/basics/refresh-token-rotation
The text was updated successfully, but these errors were encountered: