convex-auth v2.5.1
Minor Changes
Next.js SSR adapter — #343
Add a Next.js SSR adapter with HttpOnly cookie sessions.
- New:
packages/auth/src/nextjsexports the App Router surface — a route-handler proxy (/api/auth), middleware for protected routes and proactive refresh, server-side session reads, and server-action support. Sessions live in HttpOnly cookies; tokens never reach client JS. - Demo:
examples/nextjsis a working App Router app verified end-to-end against a local Convex deployment. - SSR renders verify the session server-side and fail closed: expired or revoked sessions redirect to sign-in instead of flashing authenticated UI.
Patch Changes
Session-rotation convergence — #343
- Two parallel requests presenting the same refresh token (the normal SSR pattern) no longer destroy the session.
rotateSessionmarksrotatedAtand reports"converge"inside a 15s grace window;convergeSessionmints a bounded sibling session+refresh pair in the same family. Bounds: ≤8 grace redemptions per predecessor, ≤10 live sessions per family, convergence requires a live member. updateSessionnow resolves the session’s identity — OAuth/passkey sessions refresh correctly.authSessionsgainsidentityId;authRefreshTokensgainsrotatedAt/graceRedemptions.
Family-aware revocation — #349, #344
signOut,stopImpersonation, user-facingrevokeSession, and adminrevokeSessionall revoke the whole session family.revokeSessionsForUsernow marks revoked sessions’ refresh tokens too.- Audit:
session.sign_out(voluntary),session.revoke(sessions-list),refresh_token_reuse(replay detection) — admin actions stay onauth_admin_audits.
Published package fix — #345 (thanks @david-potgieter)
- The
filesallowlist shipped only a handful ofconvex-runtimemodules — installs failed withCould not resolve "./convexAuth.js"and friends. The tarball now ships the fullsrc/convex-runtime/**tree;convex/typesexport conditions point atsrc/convex-runtime/index.ts.