Next.js Refresh Token Rotation: Random Sign-Outs Fixed
Blog post from Didit
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.
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.
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.