计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
nextjs-authentication【效率与协作】Secure token storage (HttpOnly Cookies) and Middleware patterns. Use when implementing authentication, secure session storage, or auth middleware in Next.js.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use HttpOnly Cookies for token storage. Never use LocalStorage or sessionStorage.
HttpOnly, Secure cookies with SameSite: 'Lax' or 'Strict'. Set reasonable maxAge (e.g., 86400). Never store access tokens in localStorage or sessionStorage (XSS-vulnerable). LocalStorage causes hydration issues in Server Components.middleware.ts) for edge-side redirection and route protection.cookies() Promise from next/headers and must awaited.next-auth (Auth.js) or Clerk for social logins and session management.await auth() (Auth.js) or custom getSession() helper in Server Components.