Expose Auth.js (formerly NextAuth.js) REST APIs (sign in, sign out, session, providers, CSRF token) to any connect-compatible Node.js framework like Express, Fastify, or Nuxt (via h3). Current stable version 0.8.3. Active development. Key differentiator: decouples Auth.js from Next.js, enabling authentication in non-Next.js apps using the same Auth.js providers and configuration. Requires @auth/core >=0.10.0 as peer dependency. Ships TypeScript types.
npm install autheyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up an Express app with Auth.js authentication middleware using Google OAuth provider.
For Fastify, register @fastify/middie and call fastify.use(). For Nuxt, wrap with fromNodeMiddleware from h3.
Refer to Auth.js v5 documentation and ensure provider config matches the version of @auth/core installed.
Wrap app.use() in a try-catch or add a global error handler for Express.
Set AUTH_SECRET (generate using https://generate-secret.vercel.app/32) and AUTH_TRUST_HOST=true in production.
Update provider imports to PascalCase: import GoogleProvider from '@auth/core/providers/google'.
Run: npm install @auth/core
Use: import { createAuthMiddleware } from 'authey'Ensure you pass the auth config object and use it with app.use() in Express.
Provide a valid AuthConfig object with a providers array: const authConfig: AuthConfig = { providers: [...], secret: '...', trustHost: true }