Dev extends JWT cookie lifetime to 1 year to fix kiosk TV session timeouts
A developer deploying a Next.js dashboard on large-format kiosk TVs faced repeated logouts after 30 days due to an expiring JWT authentication cookie. Because the TVs are unattended and only powered on weekly, the short session window required manual technician re-authentication each month. An initial fix using middleware to silently refresh tokens caused rate-limiting errors and introduced security concerns around storing credentials client-side. The developer ultimately resolved the issue by changing a single line in the Next.js API login route, extending the cookie's maxAge from 30 days to 365 days. All existing security flags — httpOnly, secure, and sameSite — were kept intact, maintaining the same security posture as the standard web app.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in