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: custom jwt decode method for middleware #4210
feat: custom jwt decode method for middleware #4210
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/CXk7atmGRymv1LFRfNAZARW8ESQu |
Yeah this makes a lot of sense to me - @ThangHuuVu, @lluia what do you think? |
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.
LGTM, I found a typo 🙏
Awesome! I will probably need this as I haven't yet got around implementing my own JWT callback but might want to do so in the future to allow for custom options passing to it, like extended or no expiry date, and some metadata (like a user provided name for the token). I plan to re-use sessions as Personal Access Tokens for an API. and that's how I plan to create such tokens. Thanks for the pr @hinsxd let's hope it can get merged =) |
Co-authored-by: Thang Vu <31528554+ThangHuuVu@users.noreply.github.com>
@ThangHuuVu Thanks for spotting the typo! |
Hey so this looks great, however we're going to hold off on merging and releasing a new version for a bit until Balazs is back from break. We appreciate the contribution though and will keep you posted! |
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.
Thank you! Looks good! 🙌
Reasoning 💡
As mentioned in #4181, having a custom
jwt.decode
method in[...nextauth].ts
will cause errors in any_middleware.ts
when the middleware tries to callgetToken()
internally without the correct decode method.Checklist 🧢
jwt.decode
option to middleware and pass it togetToken
Affected issues 🎟
Fixes #4181