Replies: 3 comments
-
It might be helpful to know that NextAuth.js can also update JWT using middleware
|
Beta Was this translation helpful? Give feedback.
-
I have indeed a similar problem at the moment. Can you share your code? |
Beta Was this translation helpful? Give feedback.
-
It looks like you've done a great job implementing JWT token refreshing with NextAuth.js! If you're interested in exploring another approach or looking for inspiration, you might want to check out [Next-Refresh-Token](https://github.com/yshen-max/Next-Refresh-Token). This repository provides a clean and effective implementation for managing token refresh logic in Next.js applications, which could complement or enhance your current setup. It’s worth a look if you’re diving deeper into seamless authentication workflows! |
Beta Was this translation helpful? Give feedback.
-
Greetings, I recently integrated NextAuth.js into a project using JWT for authentication. While it works great, I noticed that handling token expiration requires additional logic to refresh tokens without logging users out abruptly. I solved this by setting up automatic token refreshing using the jwt callback to check the expiration and request a new token before it expires. This way, users experience seamless login sessions. I can share my implementation if anyone is interested or struggling with a similar setup.
Beta Was this translation helpful? Give feedback.
All reactions