DEV Community

Discussion on: Next.js Authentication - JWT Refresh Token Rotation with NextAuth.js

 
mabaranowski profile image
Mateusz Baranowski • Edited

I originally used it to decide if I want to be redirected or not:

export default function useAuth(shouldRedirect) {
  ...
  signOut({ callbackUrl: '/login', redirect: shouldRedirect });
  ...
}
Enter fullscreen mode Exit fullscreen mode

When the user is on the unprotected page, and for whatever reason his token expires, I want to silently log him out, without redirecting him to the login page.

I'll update the example code with this redirect flag :)

Thread Thread
 
htissink profile image
Henrick Tissink

That functionality sounds great :) thanks for updating!