Content Deep Dive

Next.js Refresh Token Rotation: Random Sign-Outs Fixed

Blog post from Didit

Aggregate trend data notice

Excluded from normalized aggregate trends after staff review: 3056 posts were attributed to March 2026; 671 shared March 14, 2026. The preceding six-month median was 13.5 posts.

Review evidence: 3,056 posts in March 2026; 671 shared March 14, 2026; preceding six-month median 13.5. Reviewed August 9, 2026.

This company's pages remain public, but its content is excluded from normalized aggregate trends. Unfiltered raw trends and advanced filtering are available to Accelerate and Lead accounts.

Post Details
Company
Date Published
Author
Alberto Rosas
Word Count
4,048
Company Posts That Month
80
Language
English
Hacker News Points
-
Post removed?
No
Summary

On multi-instance Next.js deployments using Didit Authentication, users may be signed out when two server processes try to rotate the same single-use refresh token at once: the first succeeds, while the second presents a spent token and triggers session termination. The article recommends letting the SDK’s proxy handle refreshes as the sole token-rotation path, running that proxy on protected routes, and checking authentication with `auth()` at each data access or mutation rather than adding custom refresh logic. It also explains that `DIDIT_SESSION_CACHE_SECONDS` controls how quickly revoked sessions are detected (30 seconds by default), access tokens last at most five minutes, and custom-domain issuer changes can temporarily cause 401 responses unless the issuer setting is updated or both issuers are accepted during token expiry.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
MCP 18 2,239 237 86 -86%
AI Agents 4 1,592 295 106 -83%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.