@flinkk/shared-auth
v1.0.15
Published
NextAuth configuration and session helpers shared by every Flinkk app.
Readme
@flinkk/shared-auth
NextAuth configuration and session helpers shared by every Flinkk app.
Exports
| Subpath | What it is |
| --- | --- |
| @flinkk/shared-auth/options | authOptions — the shared NextAuth config (providers, JWT/session callbacks, CustomSession type). |
| @flinkk/shared-auth/server-session | getServerSession() — a wrapper around NextAuth's own getServerSession with retry logic for intermittent session-lookup failures. |
| @flinkk/shared-auth/token | getToken({ req }) — reads/verifies the NextAuth JWT from a request (used by API routes and middleware). |
| @flinkk/shared-auth/utils/field-permissions-utils | getFieldPermissionsFromSession(entityType) / getFieldPermissions(entityType, org) — resolves custom-field view/edit permissions. |
| @flinkk/shared-auth/utils/hash-password | Password hashing/verification (bcrypt). |
| @flinkk/shared-auth/services/createUser | Shared user-creation flow (used by signup and invite-acceptance). |
| @flinkk/shared-auth/components/session-wrapper | <SessionWrapper> — client-side SessionProvider wrapper apps use in their root layout. |
| @flinkk/shared-auth/report-edge-identity | Identity reporting for edge-runtime requests (middleware). |
Usage
import { getServerSession } from "@flinkk/shared-auth/server-session";
const { userId } = await getServerSession();Environment variables
NEXTAUTH_SECRET,NEXTAUTH_URL— standard NextAuth config.