You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am just experimenting with the library using Oauth providers like Github and Google and just following the official guides. Everything works as expected apart from the automatic JWT refresh while the session is active. (which I'd expect to have)
When I set any value for the jwt.maxAge, in order to have it expired, for example after 15mins, the middleware does not update the jwt and the user is required to re-login. The session has age of 30 days which is the default. Shouldn't the library regenerate a fresh jwt while the session is not over?
auth.js
import NextAuth from "next-auth";
import GitHub from "next-auth/providers/github";
export const {
handlers: { GET, POST },
auth,
signIn,
signOut,
} = NextAuth({
providers: [GitHub],
jwt: {
maxAge: 10
}
});
middleware.ts
export { auth as default } from "./auth";
export const config = {
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
};
Isn't this feature provided by default? Is it expected to implement it manually?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am just experimenting with the library using Oauth providers like Github and Google and just following the official guides. Everything works as expected apart from the automatic JWT refresh while the session is active. (which I'd expect to have)
When I set any value for the
jwt.maxAge
, in order to have it expired, for example after 15mins, the middleware does not update the jwt and the user is required to re-login. The session has age of 30 days which is the default. Shouldn't the library regenerate a fresh jwt while the session is not over?auth.js
middleware.ts
Isn't this feature provided by default? Is it expected to implement it manually?
Beta Was this translation helpful? Give feedback.
All reactions