Skip to main content
Run any Skill in Manus
with one click

nextjs-better-auth-session-guard

Stars1
Forks0
UpdatedJanuary 27, 2026 at 08:46

Fix session invalidation detection in Next.js 16 App Router with Better Auth. Use when: (1) Signed-out header but protected content still visible after sign-out, (2) Session changes not detected until page interaction/reload, (3) E2E tests fail with "should maintain session after page reload" or similar session persistence tests, (4) Users can view dashboard content after signing out until they click something. Implements dual-layer auth: server-side check (initial render) + client-side monitoring (runtime invalidation detection) using Better Auth's useSession hook with proper polling configuration.

Installation

Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.

SKILL.md
readonly