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
feat: Add the support of custom cookieName on the next-auth/middleware #4385
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/55C7fRvzBuBHV8CUbuEHBE3x16Gs [Deployment for f942064 canceled] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
My end goal is to match the API of NextAuth
within Middleware (so once we are fully edge-compatible, we can reduce the public API surface again, probably in v5), so I appreciate that you used the same API.
As for the docs, I think we should use what's already in https://next-auth.js.org/configuration/options#cookies
Removing the parts that aren't configurable right now.
It looks good to me otherwise. Were you actually be able to test it out?
Done 🎉
Don't find the middleware testing file to add more tests, any help about implementation of it will be appreciate |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Reasoning 💡
When using the advanced custom cookie feature in next-auth, the middleware no longer works due to the fact that it looks for the default names of next-auth. The middleware calls
getToken
without allowing to override the cookie nameChecklist 🧢
Affected issues 🎟
No
Notes
Try to following the work done in this PR to make more flexible merge in the future #4210