Next.js Discord

Discord Forum

custom-expiry-time-in-jwt-token-in-nextauth

Unanswered
Bigeye scad posted this in #help-forum
Open in Discord
Bigeye scadOP
How to set custom expiry time for jwt in next-auth, i want to setup the time based on remember me marked on the frontend, but when setting token.exp in jwt callback nothing happens, the token expiry time remains 30 days which is default, i'm using next-auth v4, setting maxAge attribute in session object in auth options make a change but i can't set up it based on remember me value from frontend because variable is not accessible in that scope, anyone also encountered that issue?

I'm using credentials provider


i tried setting token.exp in jwt callback, even in session callback i set session.expires but no difference in the token expiry time

0 Replies