core
@particular/auth
Authentication and authorization with global auth schema
Installation
bun add @particular/auth
Subpath Imports
| Import Path | Description |
|---|---|
| @particular/auth/client | Client-side auth utilities |
| @particular/auth/server | Server-side auth utilities |
Key Exports
| Export | Type | Description |
|---|---|---|
| auth | function | Auth instance for server-side usage |
| signIn | function | Sign in a user |
| signOut | function | Sign out the current user |
| useSession | hook | Access the current session |
Usage Examples
Server-side auth check
import { auth } from "@particular/auth/server";
const session = await auth();
if (!session) redirect("/auth/signin");