nextjs-supabase-auth
Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.
Author
Category
Development ToolsInstall
Hot:1
Download and extract to your skills directory
Copy command and send to OpenClaw for auto-install:
Download and install this skill https://openskills.cc/api/download?slug=sickn33-skills-nextjs-supabase-auth&locale=en&source=copy
Next.js + Supabase Auth Authentication Integration
Skill Overview
nextjs-supabase-auth is an expert-level AI skill focused on integrating Supabase authentication into the Next.js App Router. It helps you handle the server/client boundary, authentication in middleware, login logic in Server Components, and login logic in Server Actions.
Use Cases
Core Features
Common Questions
How to integrate Supabase Auth with the Next.js App Router?
Use the @supabase/ssr package to create different client instances based on context. In Server Components, use
createServerClient; in Route Handlers, pass cookies; in the client, use createBrowserClient. This skill guides you on how to correctly distinguish and create clients for each scenario.How is session refreshing in Supabase automatically handled in Next.js?
In Next.js middleware (middleware.ts), calling
supabase.auth.getSession() automatically refreshes expired sessions. This skill emphasizes placing the refresh logic in middleware rather than in components, ensuring that requests to all protected routes automatically update the session in cookies.Why can’t you use getSession directly in Server Components?
Server Components execute during rendering, while
getSession needs to read session information from cookies. The correct approach is to handle session refreshing in middleware ahead of time, or use a helper function to read the session from cookies and pass it to components. This skill helps you avoid common server-side authentication anti-patterns.