Authentication

Add authentication to your app with social login, email/password, and session management. Scaffolds Auth.js with your chosen providers and database adapter.

loginoauthsessionsusers

Providers

Auth.js

Full-featured authentication with 80+ OAuth providers and database adapters

next-auth
AUTH_SECRET

Usage

Protect a route

Check authentication status in a server component

import { auth } from '@/lib/auth'
import { redirect } from 'next/navigation'

export default async function DashboardPage() {
  const session = await auth()
  if (!session) redirect('/login')

  return <h1>Welcome, {session.user.name}</h1>
}

Get Started

Add authentication to your Primstack project with a single command:

prim auth init