A lightweight Firebase authentication library for Next.js supporting both SSR and CSR components. Version 0.0.5 provides React context-based auth with automatic Firebase app initialization from environment variables or custom configuration. Key differentiators: minimal setup with automatic cookie-based session management (BaseCookieManager), path-based auth redirects via onPathChange callback, and separate client provider pattern to preserve SSR. Pitfalls: cookie caching issues with push navigation (recommends replace+refresh), requires both firebase and firebase-admin peer deps, and early-stage package with limited documentation. The library ships TypeScript definitions but has low adoption and infrequent updates.
npm install next-fire-authNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up NextFireAuthContextProvider in a separate client component to preserve SSR, with path-based auth redirects.
Use router.replace(pathname); router.refresh(); instead of router.push(pathname).
Add "use client"; at the top of the file using the provider.
Set FIREBASE_CLIENT_EMAIL and FIREBASE_PRIVATE_KEY in your .env.local or server environment.
Pass a FirebaseApp instance obtained from initializeApp().
Avoid relying on BaseCookieManager directly; pass undefined to use default or implement your own cookie manager.
Add "use client"; at the top of the file before any imports.
Ensure all required NEXT_PUBLIC_FIREBASE_* env variables are set correctly, or pass a custom firebaseApp in config.
Import 'firebase/auth' in your project and ensure Firebase is properly initialized before using auth methods.
Use import { NextFireAuthContextProvider } from 'next-fire-auth' instead of require().Verify FIREBASE_PRIVATE_KEY is set correctly (including newlines) and that the Firebase project ID is correct.