{"_id":"@api-buddy/auth-firebase","_rev":"2-1bd49c7840abe79de13aaa71f93cc06f","name":"@api-buddy/auth-firebase","dist-tags":{"latest":"3.0.0"},"versions":{"2.0.0":{"name":"@api-buddy/auth-firebase","version":"2.0.0","keywords":["api-buddy","authentication","firebase","auth","react","nextjs","hooks"],"_id":"@api-buddy/auth-firebase@2.0.0","maintainers":[{"name":"iamtomhanks","email":"brechanson@gmail.com"}],"dist":{"shasum":"c13a852d8e9db7a08dab15c345076aa21a121955","tarball":"https://registry.npmjs.org/@api-buddy/auth-firebase/-/auth-firebase-2.0.0.tgz","fileCount":8,"integrity":"sha512-KgEy1XP06WVCxPg8yn02aYcQ80ziRabJsqExMrdbqg5SX3tHT1lhRo40qOD75yvLV5w8y/0Hopz7zAzP8IZLBw==","signatures":[{"sig":"MEQCIA0a89LlT/dQGNBgNEnaIpCtoGAwKn2W6J6ek3SE1VKQAiA/LCZ75jwwmvcc7fDdGjhZtYlzYr9TNtBJRBcxMmh7FQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":99648},"main":"dist/index.js","_from":"file:api-buddy-auth-firebase-2.0.0.tgz","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=16.0.0"},"scripts":{"dev":"tsup --watch","lint":"eslint src --ext .ts,.tsx","test":"vitest run","build":"pnpm clean && tsup","clean":"rimraf dist","format":"prettier --write \"src/**/*.{ts,tsx}\"","test:watch":"vitest","type-check":"tsc --noEmit","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"iamtomhanks","email":"brechanson@gmail.com"},"_resolved":"/private/var/folders/w3/00m0j5k95zjfx4vwz3csj_vc0000gn/T/78dfba1b67b0905e43f8454710ee0a31/api-buddy-auth-firebase-2.0.0.tgz","_integrity":"sha512-KgEy1XP06WVCxPg8yn02aYcQ80ziRabJsqExMrdbqg5SX3tHT1lhRo40qOD75yvLV5w8y/0Hopz7zAzP8IZLBw==","_npmVersion":"9.8.1","description":"Firebase Authentication for API Buddy - Core package with React hooks and utilities","directories":{},"_nodeVersion":"18.18.0","dependencies":{"firebase":"^10.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.2","rimraf":"^5.0.5","vitest":"^1.0.0","typescript":"^5.0.0","@types/node":"^20.0.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@api-buddy/tsup-config":"2.0.0"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0","firebase":"^10.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-firebase_2.0.0_1750112546010_0.5230230108719061","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@api-buddy/auth-firebase","version":"3.0.0","description":"Firebase Authentication for API Buddy - Core package with React hooks and utilities","type":"module","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"keywords":["api-buddy","authentication","firebase","auth","react","nextjs","hooks"],"peerDependencies":{"firebase":"^10.0.0","next":">=14.0.0","react":">=18.0.0","react-dom":">=18.0.0"},"dependencies":{"firebase":"^10.0.0","zod":"^3.22.0","@api-buddy/types":"4.0.0","@api-buddy/codegen":"3.0.0"},"devDependencies":{"@types/node":"^20.0.0","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","rimraf":"^5.0.5","tsup":"^8.0.2","typescript":"^5.0.0","vitest":"^1.0.0","@api-buddy/tsup-config":"3.0.0","@api-buddy/types":"4.0.0","@api-buddy/codegen":"3.0.0"},"engines":{"node":">=16.0.0"},"scripts":{"build":"pnpm clean && tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","clean":"rimraf dist","lint":"eslint src --ext .ts,.tsx","type-check":"tsc --noEmit","format":"prettier --write \"src/**/*.{ts,tsx}\""},"_id":"@api-buddy/auth-firebase@3.0.0","_integrity":"sha512-y0jtvcC2HOWMU1MbgIqO7YJ3oOedZ3hRSRPIz8wmbFA0hntNDjISJpdvg3702z9PXC9dzNdhaTaL+trkcthdFg==","_resolved":"/private/var/folders/w3/00m0j5k95zjfx4vwz3csj_vc0000gn/T/640d2e9453e7b3eea383bb8fcea43659/api-buddy-auth-firebase-3.0.0.tgz","_from":"file:api-buddy-auth-firebase-3.0.0.tgz","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-y0jtvcC2HOWMU1MbgIqO7YJ3oOedZ3hRSRPIz8wmbFA0hntNDjISJpdvg3702z9PXC9dzNdhaTaL+trkcthdFg==","shasum":"dc1ac252fea122ceadc478aaf530a0a1cab7bbc1","tarball":"https://registry.npmjs.org/@api-buddy/auth-firebase/-/auth-firebase-3.0.0.tgz","fileCount":8,"unpackedSize":100376,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDe+51cSbCbEE08vdkYO9vaGOzQbQ/wmVJQoBj1TFkfGQIhAL1N75RQ/V0Nx54U1HJzVvVp/PpAAyAu1KOCHLIGJCTr"}]},"_npmUser":{"name":"iamtomhanks","email":"brechanson@gmail.com","actor":{"name":"iamtomhanks","email":"brechanson@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"iamtomhanks","email":"brechanson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth-firebase_3.0.0_1751386834868_0.786920488074863"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-16T22:22:25.924Z","modified":"2025-07-01T16:20:35.237Z","2.0.0":"2025-06-16T22:22:26.203Z","3.0.0":"2025-07-01T16:20:35.052Z"},"keywords":["api-buddy","authentication","firebase","auth","react","nextjs","hooks"],"description":"Firebase Authentication for API Buddy - Core package with React hooks and utilities","maintainers":[{"name":"iamtomhanks","email":"brechanson@gmail.com"}],"readme":"# @api-buddy/auth-firebase\r\n\r\nCore Firebase Authentication package for API Buddy, providing React hooks, providers, and utilities for Firebase Auth integration in Next.js applications.\r\n\r\n## Features\r\n\r\n- 🔐 **Authentication Methods**\r\n  - Email/Password authentication\r\n  - Social logins (Google, Facebook, Twitter, GitHub, etc.)\r\n  - Phone authentication\r\n  - Anonymous sign-in\r\n  - Email verification\r\n  - Password reset flow\r\n\r\n- 🛡 **Security**\r\n  - Secure session management\r\n  - Type-safe API integration\r\n  - Automatic token refresh\r\n  - Comprehensive error handling\r\n\r\n- 🚀 **Developer Experience**\r\n  - React hooks for easy integration\r\n  - Full TypeScript support\r\n  - Flexible provider pattern\r\n  - Development emulator support\r\n\r\n## Table of Contents\r\n\r\n- [Installation](#installation)\r\n- [Quick Start](#quick-start)\r\n- [Configuration](#configuration)\r\n- [API Reference](#api-reference)\r\n- [Usage Examples](#usage-examples)\r\n- [CLI Commands](#cli-commands)\r\n- [Customization](#customization)\r\n- [Troubleshooting](#troubleshooting)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Installation\r\n\r\n### Prerequisites\r\n\r\n- Node.js 18+\r\n- Next.js 14+\r\n- Firebase project (create one at [Firebase Console](https://console.firebase.google.com/))\r\n\r\n### Install Package\r\n\r\n```bash\r\n# Using npm\r\nnpm install @api-buddy/auth-firebase firebase\r\n\r\n# Using yarn\r\nyarn add @api-buddy/auth-firebase firebase\r\n\r\n# Using pnpm\r\npnpm add @api-buddy/auth-firebase firebase\r\n```\r\n\r\n## Basic Usage\r\n\r\n1. **Setup Firebase Client**\r\n\r\n   First, initialize Firebase in your application:\r\n\r\n   ```typescript\r\n   // lib/firebase/client.ts\r\n   import { initializeApp } from 'firebase/app';\r\n   import { getAuth } from 'firebase/auth';\r\n\r\n   const firebaseConfig = {\r\n     apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,\r\n     // ... other config\r\n   };\r\n\r\n   const app = initializeApp(firebaseConfig);\r\n   export const auth = getAuth(app);\r\n   ```\r\n\r\n2. **Wrap your app with AuthProvider**\r\n\r\n   ```tsx\r\n   // app/providers.tsx\r\n   'use client';\r\n   \r\n   import { AuthProvider } from '@api-buddy/auth-firebase';\r\n   import { auth } from '@/lib/firebase/client';\r\n\r\n   export function Providers({ children }: { children: React.ReactNode }) {\r\n     return (\r\n       <AuthProvider firebaseAuth={auth}>\r\n         {children}\r\n       </AuthProvider>\r\n     );\r\n   }\r\n   ```\r\n\r\n3. **Use auth in your components**\r\n\r\n   ```tsx\r\n   // components/LoginForm.tsx\r\n   'use client';\r\n   \r\n   import { useAuth } from '@api-buddy/auth-firebase';\r\n   import { useState } from 'react';\r\n\r\n   export function LoginForm() {\r\n     const { signIn } = useAuth();\r\n     const [email, setEmail] = useState('');\r\n     const [password, setPassword] = useState('');\r\n     const [error, setError] = useState('');\r\n\r\n     const handleSubmit = async (e: React.FormEvent) => {\r\n       e.preventDefault();\r\n       try {\r\n         await signIn(email, password);\r\n         // Redirect or handle success\r\n       } catch (err) {\r\n         setError(err.message);\r\n       }\r\n     };\r\n\r\n     return (\r\n       <form onSubmit={handleSubmit}>\r\n         <input\r\n           type=\"email\"\r\n           value={email}\r\n           onChange={(e) => setEmail(e.target.value)}\r\n           placeholder=\"Email\"\r\n           required\r\n         />\r\n         <input\r\n           type=\"password\"\r\n           value={password}\r\n           onChange={(e) => setPassword(e.target.value)}\r\n           placeholder=\"Password\"\r\n           required\r\n         />\r\n         {error && <div className=\"error\">{error}</div>}\r\n         <button type=\"submit\">Sign In</button>\r\n       </form>\r\n     );\r\n   }\r\n   ```\r\n\r\n```bash\r\n# Using pnpm (recommended)\r\npnpm add @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n\r\n# Using npm\r\nnpm install @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n\r\n# Using yarn\r\nyarn add @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n```\r\n\r\n### Environment Variables\r\n\r\nCreate a `.env.local` file in your project root with the following variables:\r\n\r\n```env\r\n# Firebase Client Config\r\nNEXT_PUBLIC_FIREBASE_API_KEY=your-api-key\r\nNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com\r\nNEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id\r\nNEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com\r\nNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-sender-id\r\nNEXT_PUBLIC_FIREBASE_APP_ID=your-app-id\r\nNEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=your-measurement-id\r\n\r\n# Firebase Admin Config (server-side only)\r\nFIREBASE_ADMIN_PROJECT_ID=your-project-id\r\nFIREBASE_ADMIN_CLIENT_EMAIL=your-service-account-email\r\nFIREBASE_ADMIN_PRIVATE_KEY=\"your-private-key\"\r\n\r\n# Optional: Enable Firebase Emulator\r\nNEXT_PUBLIC_USE_FIREBASE_EMULATOR=true\r\nFIREBASE_AUTH_EMULATOR_HOST=localhost:9099\r\n```\r\n\r\n## Quick Start\r\n\r\n1. **Initialize the plugin**\r\n\r\n```bash\r\n# Run the setup wizard\r\nnpx @api-buddy/plugin-auth-firebase init\r\n\r\n# Or manually generate the required files\r\nnpx @api-buddy/plugin-auth-firebase generate\r\n```\r\n\r\n2. **Wrap your app with AuthProvider**\r\n\r\nUpdate your `app/layout.tsx`:\r\n\r\n```tsx\r\nimport { AuthProvider } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport default function RootLayout({\r\n  children,\r\n}: {\r\n  children: React.ReactNode;\r\n}) {\r\n  return (\r\n    <html lang=\"en\">\r\n      <body>\r\n        <AuthProvider>\r\n          {children}\r\n        </AuthProvider>\r\n      </body>\r\n    </html>\r\n  );\r\n}\r\n```\r\n\r\n3. **Use authentication in your components**\r\n\r\n```tsx\r\n'use client';\r\n\r\nimport { useAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport default function ProfilePage() {\r\n  const { user, loading, signOut } = useAuth();\r\n\r\n  if (loading) return <div>Loading...</div>;\r\n  if (!user) return <div>Not authenticated</div>;\r\n\r\n  return (\r\n    <div>\r\n      <h1>Welcome, {user.email}!</h1>\r\n      <button onClick={signOut}>Sign Out</button>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## Configuration\r\n\r\n### Plugin Options\r\n\r\nYou can configure the plugin by creating a `auth.config.ts` file in your project root:\r\n\r\n```ts\r\n// auth.config.ts\r\nimport type { AuthPluginConfig } from '@api-buddy/plugin-auth-firebase';\r\n\r\nconst config: AuthPluginConfig = {\r\n  // Required: Your Firebase config\r\n  firebase: {\r\n    apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY!,\r\n    authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN!,\r\n    projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID!,\r\n    // ... other Firebase config\r\n  },\r\n  \r\n  // Optional: Customize auth pages\r\n  pages: {\r\n    signIn: '/auth/signin',\r\n    signUp: '/auth/signup',\r\n    verifyEmail: '/auth/verify-email',\r\n    resetPassword: '/auth/reset-password',\r\n    error: '/auth/error',\r\n  },\r\n  \r\n  // Optional: Enable/disable features\r\n  features: {\r\n    emailVerification: true,\r\n    passwordReset: true,\r\n    socialLogins: ['google', 'github'],\r\n  },\r\n  \r\n  // Optional: Custom callbacks\r\n  callbacks: {\r\n    signIn: async (user) => {\r\n      // Custom logic after successful sign in\r\n      return true;\r\n    },\r\n    redirect: async (url, baseUrl) => {\r\n      // Custom redirect logic\r\n      return url.startsWith(baseUrl) ? url : baseUrl;\r\n    },\r\n  },\r\n};\r\n\r\nexport default config;\r\n```\r\n\r\n## API Reference\r\n\r\n### Hooks\r\n\r\n#### `useAuth()`\r\n\r\nA React hook that provides authentication state and methods.\r\n\r\n```tsx\r\nconst {\r\n  user,           // Current user or null\r\n  loading,        // Loading state\r\n  error,          // Error object if any\r\n  signIn,         // Sign in function\r\n  signUp,         // Sign up function\r\n  signOut,        // Sign out function\r\n  resetPassword,  // Reset password function\r\n  updateProfile,  // Update profile function\r\n  reload,         // Reload user data\r\n} = useAuth();\r\n```\r\n\r\n#### `useSession()`\r\n\r\nA React hook to access the current session.\r\n\r\n```tsx\r\nconst { session, status } = useSession();\r\n```\r\n\r\n### Server Components\r\n\r\n#### `getServerSession()`\r\n\r\nGet the session in a Server Component.\r\n\r\n```tsx\r\nimport { getServerSession } from '@api-buddy/plugin-auth-firebase/server';\r\n\r\nexport default async function Page() {\r\n  const session = await getServerSession();\r\n  // ...\r\n}\r\n```\r\n\r\n### Middleware\r\n\r\n#### `withAuth`\r\n\r\nHigher-order function to protect API routes.\r\n\r\n```ts\r\nimport { withAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport const GET = withAuth(async (req, user) => {\r\n  // This route is protected and will only run for authenticated users\r\n  return Response.json({ user });\r\n});\r\n```\r\n\r\n## CLI Commands\r\n\r\n### Initialize\r\n\r\n```bash\r\n# Run the setup wizard\r\nnpx @api-buddy/plugin-auth-firebase init\r\n\r\n# Or generate files with options\r\nnpx @api-buddy/plugin-auth-firebase generate \\\r\n  --pages login,signup,profile,reset-password \\\r\n  --api\r\n```\r\n\r\n### Available Commands\r\n\r\n- `init`: Interactive setup wizard\r\n- `generate`: Generate auth pages and API routes\r\n- `add-user`: Add a new user (admin only)\r\n- `list-users`: List all users (admin only)\r\n\r\n## Customization\r\n\r\n### Custom Pages\r\n\r\nYou can create custom auth pages by creating files in the `app/auth` directory:\r\n\r\n- `signin/page.tsx` - Sign in page\r\n- `signup/page.tsx` - Sign up page\r\n- `reset-password/page.tsx` - Password reset page\r\n- `verify-email/page.tsx` - Email verification page\r\n- `error/page.tsx` - Error page\r\n\r\n### Custom Components\r\n\r\nYou can use the provided UI components or create your own:\r\n\r\n```tsx\r\nimport { AuthForm, SocialLoginButtons } from '@api-buddy/plugin-auth-firebase/components';\r\n\r\nfunction CustomSignIn() {\r\n  return (\r\n    <div>\r\n      <h1>Welcome Back</h1>\r\n      <AuthForm type=\"signin\" />\r\n      <SocialLoginButtons providers={['google', 'github']} />\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## Troubleshooting\r\n\r\n### Common Issues\r\n\r\n#### Firebase Admin Initialization Error\r\n\r\n```\r\nError: Failed to initialize Firebase Admin: Error: Failed to parse private key\r\n```\r\n\r\nMake sure your `FIREBASE_ADMIN_PRIVATE_KEY` is properly formatted with escaped newlines:\r\n\r\n```env\r\n# Correct\r\nFIREBASE_ADMIN_PRIVATE_KEY=\"-----BEGIN PRIVATE KEY-----\\nMII...\\n-----END PRIVATE KEY-----\\n\"\r\n\r\n# Incorrect\r\nFIREBASE_ADMIN_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\r\nMII...\r\n-----END PRIVATE KEY-----\r\n```\r\n\r\n#### CORS Errors\r\n\r\nIf you're seeing CORS errors in development, make sure to configure your CORS headers:\r\n\r\n```ts\r\n// middleware.ts\r\nimport { NextResponse } from 'next/server';\r\nimport type { NextRequest } from 'next/server';\r\n\r\nexport function middleware(request: NextRequest) {\r\n  const response = NextResponse.next();\r\n  \r\n  // Set CORS headers\r\n  response.headers.set('Access-Control-Allow-Origin', '*');\r\n  response.headers.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');\r\n  response.headers.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');\r\n  \r\n  return response;\r\n}\r\n```\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on how to get started.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\nyarn add @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n```\r\n\r\n## Quick Start\r\n\r\n1. **Initialize Firebase Auth in your Next.js app**:\r\n\r\n```bash\r\n# Using API Buddy CLI\r\napi-buddy firebase-auth init\r\n\r\n# Or manually\r\nnpx @api-buddy/plugin-auth-firebase init\r\n```\r\n\r\n2. **Set up environment variables** in `.env.local`:\r\n\r\n```env\r\n# Firebase Client Configuration\r\nNEXT_PUBLIC_FIREBASE_API_KEY=your-api-key\r\nNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-app.firebaseapp.com\r\nNEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id\r\nNEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-bucket.appspot.com\r\nNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-sender-id\r\nNEXT_PUBLIC_FIREBASE_APP_ID=your-app-id\r\n\r\n# Firebase Admin Configuration\r\nFIREBASE_ADMIN_PROJECT_ID=your-project-id\r\nFIREBASE_ADMIN_CLIENT_EMAIL=your-service-account@project.iam.gserviceaccount.com\r\nFIREBASE_ADMIN_PRIVATE_KEY=\"-----BEGIN PRIVATE KEY-----\\nYourPrivateKeyHere\\n-----END PRIVATE KEY-----\\n\"\r\n```\r\n\r\n3. **Wrap your app with AuthProvider** in `app/layout.tsx`:\r\n\r\n```tsx\r\nimport { AuthProvider } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport default function RootLayout({\r\n  children,\r\n}: {\r\n  children: React.ReactNode\r\n}) {\r\n  return (\r\n    <html lang=\"en\">\r\n      <body>\r\n        <AuthProvider>\r\n          {children}\r\n        </AuthProvider>\r\n      </body>\r\n    </html>\r\n  )\r\n}\r\n```\r\n\r\n4. **Use authentication in your components**:\r\n\r\n```tsx\r\n'use client';\r\n\r\nimport { useAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport default function Profile() {\r\n  const { user, loading, signOut } = useAuth();\r\n\r\n  if (loading) return <div>Loading...</div>;\r\n  if (!user) return <div>Please sign in</div>;\r\n\r\n  return (\r\n    <div>\r\n      <h1>Welcome, {user.email}!</h1>\r\n      <button onClick={signOut}>Sign Out</button>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## Configuration\r\n\r\n### Firebase Setup\r\n\r\n1. Go to the [Firebase Console](https://console.firebase.google.com/)\r\n2. Create a new project or select an existing one\r\n3. Navigate to Project Settings > General\r\n4. Under \"Your apps\", add a new web app\r\n5. Copy the configuration object and add it to your environment variables\r\n\r\n### Environment Variables\r\n\r\n| Variable | Description | Required | Default |\r\n|----------|-------------|:--------:|:-------:|\r\n| `NEXT_PUBLIC_FIREBASE_API_KEY` | Firebase API key | ✅ | - |\r\n| `NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN` | Firebase Auth domain | ✅ | - |\r\n| `NEXT_PUBLIC_FIREBASE_PROJECT_ID` | Firebase project ID | ✅ | - |\r\n| `NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET` | Firebase storage bucket | ✅ | - |\r\n| `NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID` | Firebase messaging sender ID | ✅ | - |\r\n| `NEXT_PUBLIC_FIREBASE_APP_ID` | Firebase app ID | ✅ | - |\r\n| `FIREBASE_ADMIN_PROJECT_ID` | Firebase Admin project ID | ✅ | - |\r\n| `FIREBASE_ADMIN_CLIENT_EMAIL` | Firebase Admin client email | ✅ | - |\r\n| `FIREBASE_ADMIN_PRIVATE_KEY` | Firebase Admin private key | ✅ | - |\r\n\r\n## Usage\r\n\r\n### Authentication Methods\r\n\r\n#### Email/Password Authentication\r\n\r\n```tsx\r\nimport { useAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nfunction AuthForm() {\r\n  const { signUp, signIn, signOut, user } = useAuth();\r\n\r\n  const handleSignUp = async (email: string, password: string) => {\r\n    try {\r\n      await signUp(email, password);\r\n      // User is signed up and signed in\r\n    } catch (error) {\r\n      console.error('Error signing up:', error);\r\n    }\r\n  };\r\n\r\n  // Similar for signIn and signOut\r\n}\r\n```\r\n\r\n#### Social Authentication\r\n\r\n```tsx\r\nfunction SocialAuth() {\r\n  const { signInWithGoogle, signInWithFacebook } = useAuth();\r\n\r\n  return (\r\n    <div>\r\n      <button onClick={signInWithGoogle}>Sign in with Google</button>\r\n      <button onClick={signInWithFacebook}>Sign in with Facebook</button>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n### Protected Routes\r\n\r\n```tsx\r\nimport { withAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nfunction ProtectedPage() {\r\n  return <div>This is a protected page</div>;\r\n}\r\n\r\nexport default withAuth(ProtectedPage);\r\n```\r\n\r\n## API Reference\r\n\r\n### Hooks\r\n\r\n#### `useAuth()`\r\n\r\nMain authentication hook that provides authentication state and methods.\r\n\r\n```tsx\r\nconst {\r\n  user,           // Current user object or null\r\n  loading,        // Loading state\r\n  error,          // Error object if any\r\n  signIn,         // Email/password sign in\r\n  signUp,         // Email/password sign up\r\n  signOut,        // Sign out\r\n  resetPassword,  // Send password reset email\r\n  updateProfile,  // Update user profile\r\n  // Social auth methods\r\n  signInWithGoogle,\r\n  signInWithFacebook,\r\n  signInWithTwitter,\r\n  signInWithGithub,\r\n  signInAnonymously,\r\n} = useAuth();\r\n```\r\n\r\n### Components\r\n\r\n#### `AuthProvider`\r\n\r\nProvider component that should wrap your application.\r\n\r\n#### `ProtectedRoute`\r\n\r\nComponent that renders children only if user is authenticated.\r\n\r\n```tsx\r\nimport { ProtectedRoute } from '@api-buddy/plugin-auth-firebase';\r\n\r\nfunction App() {\r\n  return (\r\n    <ProtectedRoute>\r\n      <YourProtectedContent />\r\n    </ProtectedRoute>\r\n  );\r\n}\r\n```\r\n\r\n## Advanced Usage\r\n\r\n### Custom Authentication Pages\r\n\r\nYou can create custom authentication pages by using the provided hooks and components:\r\n\r\n```tsx\r\n// app/auth/custom-signin/page.tsx\r\n'use client';\r\n\r\nimport { useAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport default function CustomSignIn() {\r\n  const { signIn } = useAuth();\r\n  \r\n  const handleSubmit = async (e: React.FormEvent) => {\r\n    e.preventDefault();\r\n    const formData = new FormData(e.target as HTMLFormElement);\r\n    const email = formData.get('email') as string;\r\n    const password = formData.get('password') as string;\r\n    \r\n    try {\r\n      await signIn(email, password);\r\n    } catch (error) {\r\n      console.error('Sign in failed:', error);\r\n    }\r\n  };\r\n\r\n  return (\r\n    <form onSubmit={handleSubmit}>\r\n      <input name=\"email\" type=\"email\" required />\r\n      <input name=\"password\" type=\"password\" required />\r\n      <button type=\"submit\">Sign In</button>\r\n    </form>\r\n  );\r\n}\r\n```\r\n\r\n## Troubleshooting\r\n\r\n### Common Issues\r\n\r\n#### Missing Environment Variables\r\nEnsure all required environment variables are set in your `.env.local` file.\r\n\r\n#### CORS Issues\r\nIf you encounter CORS issues, make sure your Firebase Auth domain is properly configured in the Firebase Console.\r\n\r\n#### Authentication Errors\r\nCheck the browser console and server logs for detailed error messages. Common issues include:\r\n- Incorrect API keys\r\n- Unauthorized domain\r\n- Disabled authentication methods\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please read our [contributing guide](CONTRIBUTING.md) to get started.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n  - Hooks for auth state changes\r\n  - Server-side rendering support\r\n  - API route protection\r\n\r\n- 📱 **Mobile Ready**\r\n  - Responsive design\r\n  - Touch-friendly components\r\n  - Offline support\r\n  - PWA ready\r\n\r\n- 🎨 **UI Components**\r\n  - Pre-built auth forms\r\n  - Customizable themes\r\n  - Loading states\r\n  - Error handling\r\n\r\n## Quick Start\r\n\r\n### 1. Install the Plugin\r\n\r\n```bash\r\n# Using pnpm (recommended)\r\npnpm add @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n\r\n# Using npm\r\nnpm install @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n\r\n# Using yarn\r\nyarn add @api-buddy/plugin-auth-firebase firebase firebase-admin\r\n```\r\n\r\n### 2. Initialize the Plugin\r\n\r\n```typescript\r\n// In your app's plugin configuration\r\nimport { FirebaseAuthPlugin } from '@api-buddy/plugin-auth-firebase';\r\n\r\nconst firebaseConfig = {\r\n  apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,\r\n  authDomain: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,\r\n  projectId: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID,\r\n  storageBucket: process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET,\r\n  messagingSenderId: process.env.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID,\r\n  appId: process.env.NEXT_PUBLIC_FIREBASE_APP_ID,\r\n  \r\n  // Optional: Configure which auth methods are enabled\r\n  enableGoogleSignIn: true,\r\n  enableFacebookSignIn: true,\r\n  enableTwitterSignIn: true,\r\n  enableGithubSignIn: true,\r\n  enablePhoneSignIn: true,\r\n  enableAnonymousSignIn: true,\r\n  \r\n  // Optional: Session persistence (default: 'local')\r\n  // 'local' - persists even when the window is closed\r\n  // 'session' - persists in current session/tab\r\n  // 'none' - no persistence\r\n  persistence: 'local'\r\n};\r\n\r\n// Initialize the plugin\r\nconst firebaseAuth = new FirebaseAuthPlugin(firebaseConfig);\r\n\r\n// Register with your app's plugin system\r\napp.registerPlugin(firebaseAuth);\r\n```\r\n\r\n### 3. Generate Authentication Pages and API Routes\r\n\r\nUse the API Buddy CLI to generate authentication pages and API routes:\r\n\r\n```bash\r\n# Generate all auth pages and API routes\r\napi-buddy firebase-auth generate\r\n\r\n# Or specify which pages to generate\r\napi-buddy firebase-auth generate --pages login,signup,profile,reset-password\r\n\r\n# Skip API routes generation\r\napi-buddy firebase-auth generate --no-api\r\n\r\n# Specify custom output directory (default: 'app')\r\napi-buddy firebase-auth generate --output src/app\r\n```\r\n\r\n### 4. Use the Auth Context in Your Components\r\n\r\n```tsx\r\n'use client';\r\n\r\nimport { useAuth } from '@api-buddy/plugin-auth-firebase';\r\n\r\nexport function UserProfile() {\r\n  const { user, loading, error } = useAuth();\r\n  \r\n  if (loading) return <div>Loading...</div>;\r\n  if (error) return <div>Error: {error.message}</div>;\r\n  if (!user) return <div>Please sign in</div>;\r\n  \r\n  return (\r\n    <div>\r\n      <h1>Welcome, {user.email}!</h1>\r\n      <button onClick={() => auth.signOut()}>Sign Out</button>\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n## API Reference\r\n\r\n### Auth Methods\r\n\r\n#### `signInWithEmail(email: string, password: string)`\r\nSign in with email and password.\r\n\r\n```typescript\r\ntry {\r\n  const user = await auth.signInWithEmail('user@example.com', 'password123');\r\n  console.log('Signed in:', user.uid);\r\n} catch (error) {\r\n  console.error('Sign in failed:', error);\r\n}\r\n```\r\n\r\n#### `signUpWithEmail(email: string, password: string)`\r\nCreate a new user account with email and password.\r\n\r\n#### `signInWithGoogle()`\r\nSign in with Google OAuth.\r\n\r\n#### `signInWithFacebook()`\r\nSign in with Facebook OAuth.\r\n\r\n#### `signInWithTwitter()`\r\nSign in with Twitter OAuth.\r\n\r\n#### `signInWithGithub()`\r\nSign in with GitHub OAuth.\r\n\r\n#### `signInAnonymously()`\r\nSign in anonymously.\r\n\r\n#### `signOut()`\r\nSign out the current user.\r\n\r\n#### `getCurrentUser()`\r\nGet the currently signed-in user.\r\n\r\n#### `onAuthStateChanged(callback)`\r\nSubscribe to auth state changes.\r\n\r\n### Error Handling\r\n\r\nAll auth methods throw errors that include a `code` property for programmatic error handling:\r\n\r\n```typescript\r\ntry {\r\n  await auth.signInWithEmail('user@example.com', 'wrong-password');\r\n} catch (error) {\r\n  if (error.code === 'auth/wrong-password') {\r\n    // Handle wrong password\r\n  } else if (error.code === 'auth/user-not-found') {\r\n    // Handle user not found\r\n  }\r\n  console.error('Auth error:', error.message);\r\n}\r\n```\r\n\r\n## Configuration Options\r\n\r\n| Option | Type | Default | Description |\r\n|--------|------|---------|-------------|\r\n| `apiKey` | string | - | **Required** Firebase API key |\r\n| `authDomain` | string | - | **Required** Firebase Auth domain |\r\n| `projectId` | string | - | **Required** Firebase project ID |\r\n| `appId` | string | - | **Required** Firebase app ID |\r\n| `enableGoogleSignIn` | boolean | `false` | Enable Google Sign-In |\r\n| `enableFacebookSignIn` | boolean | `false` | Enable Facebook Sign-In |\r\n| `enableTwitterSignIn` | boolean | `false` | Enable Twitter Sign-In |\r\n| `enableGithubSignIn` | boolean | `false` | Enable GitHub Sign-In |\r\n| `enablePhoneSignIn` | boolean | `false` | Enable Phone Number Sign-In |\r\n| `enableAnonymousSignIn` | boolean | `false` | Enable Anonymous Sign-In |\r\n| `persistence` | 'local' \\| 'session' \\| 'none' | 'local' | Auth session persistence |\r\n\r\n## TypeScript Support\r\n\r\nThe plugin includes TypeScript type definitions. All auth methods and hooks are fully typed.\r\n\r\n## Security Considerations\r\n\r\n- Always use HTTPS in production\r\n- Enable appropriate security headers\r\n- Implement rate limiting\r\n- Use secure, HTTP-only cookies for sessions\r\n- Keep Firebase security rules up to date\r\n- Regularly rotate API keys and secrets\r\n\r\n### 5. Configure Environment Variables\r\n\r\nCreate or update your `.env.local` file with your Firebase configuration:\r\n\r\n```env\r\n# Client-side (NEXT_PUBLIC_*)\r\nNEXT_PUBLIC_FIREBASE_API_KEY=your-api-key\r\nNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com\r\nNEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id\r\nNEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-storage-bucket\r\nNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id\r\nNEXT_PUBLIC_FIREBASE_APP_ID=your-app-id\r\n\r\n# Server-side (only used in API routes)\r\nFIREBASE_CLIENT_EMAIL=your-service-account-email\r\nFIREBASE_PRIVATE_KEY=\"your-private-key\"\r\n\r\n# Optional: Configure which auth methods are enabled\r\nNEXT_PUBLIC_ENABLE_GOOGLE_SIGNIN=true\r\nNEXT_PUBLIC_ENABLE_FACEBOOK_SIGNIN=true\r\nNEXT_PUBLIC_ENABLE_TWITTER_SIGNIN=true\r\nNEXT_PUBLIC_ENABLE_GITHUB_SIGNIN=true\r\nNEXT_PUBLIC_ENABLE_PHONE_SIGNIN=true\r\nNEXT_PUBLIC_ENABLE_ANONYMOUS_SIGNIN=true\r\n\r\n# Optional: Session persistence (local, session, none)\r\nNEXT_PUBLIC_AUTH_PERSISTENCE=local\r\n```\r\n\r\n### 6. Start Developing\r\n\r\nRun your Next.js application:\r\n\r\n```bash\r\nnpm run dev\r\n```\r\n\r\nVisit `http://localhost:3000/auth/login` to see the login page.\r\n\r\n## Advanced Usage\r\n\r\n### Custom Auth Pages\r\n\r\nYou can customize the generated auth pages by modifying the components in the `app/auth` directory. The pages are built using [Shadcn UI](https://ui.shadcn.com/) components and can be fully customized to match your app's design.\r\n\r\n### Server-Side Authentication\r\n\r\nFor server-side authentication in API routes or server components:\r\n\r\n```typescript\r\nimport { getServerAuth } from '@api-buddy/plugin-auth-firebase/server';\r\n\r\nexport async function GET(request: Request) {\r\n  const session = await getServerAuth(request);\r\n  \r\n  if (!session) {\r\n    return new Response('Unauthorized', { status: 401 });\r\n  }\r\n  \r\n  // User is authenticated\r\n  return Response.json({ user: session.user });\r\n}\r\n```\r\n\r\n### Custom Error Pages\r\n\r\nCustomize error pages by creating the following files in your `app` directory:\r\n\r\n- `app/auth/error.tsx` - For auth-related errors\r\n- `app/not-found.tsx` - For 404 errors\r\n- `app/error.tsx` - For all other errors\r\n\r\n### Theming\r\n\r\nThe auth components support theming through CSS variables. Override the default theme in your global CSS:\r\n\r\n```css\r\n:root {\r\n  --primary: #0070f3;\r\n  --primary-foreground: #ffffff;\r\n  --border: #e2e8f0;\r\n  --input: #e2e8f0;\r\n  --ring: #0070f3;\r\n  --radius: 0.5rem;\r\n}\r\n\r\n.dark {\r\n  --background: #0f172a;\r\n  --foreground: #f8fafc;\r\n  --card: #1e293b;\r\n  --card-foreground: #f8fafc;\r\n  --popover: #1e293b;\r\n  --popover-foreground: #f8fafc;\r\n  --primary: #60a5fa;\r\n  --primary-foreground: #1e40af;\r\n  --secondary: #334155;\r\n  --secondary-foreground: #f8fafc;\r\n  --muted: #334155;\r\n  --muted-foreground: #94a3b8;\r\n  --accent: #334155;\r\n  --accent-foreground: #f8fafc;\r\n  --destructive: #7f1d1d;\r\n  --destructive-foreground: #fecaca;\r\n  --border: #334155;\r\n  --input: #334155;\r\n  --ring: #60a5fa;\r\n}\r\n```\r\n\r\n## Migration Guide\r\n\r\n### Upgrading from v0.x to v1.0\r\n\r\n1. Update your dependencies:\r\n   ```bash\r\n   pnpm up @api-buddy/plugin-auth-firebase@latest\r\n   ```\r\n\r\n2. The auth API has been updated to be more consistent. Update any direct method calls:\r\n   - `auth.signIn()` → `auth.signInWithEmail()`\r\n   - `auth.createUser()` → `auth.signUpWithEmail()`\r\n   - `auth.currentUser` → `auth.getCurrentUser()`\r\n\r\n3. The error handling has been improved. Update your error handling code to use the new error codes and messages.\r\n\r\n## Troubleshooting\r\n\r\n### Common Issues\r\n\r\n#### Firebase Not Initialized\r\nMake sure you've called `initializeApp` with your Firebase config before using any auth methods.\r\n\r\n#### CORS Errors\r\nIf you're seeing CORS errors, make sure your Firebase Auth domain is properly configured in the Firebase Console.\r\n\r\n#### Invalid API Key\r\nDouble-check that your Firebase API key is correct and hasn't been restricted in the Firebase Console.\r\n\r\n#### Session Persistence\r\nIf users are being signed out unexpectedly, check your `persistence` setting and ensure it matches your app's requirements.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please read our [contributing guide](CONTRIBUTING.md) to get started.\r\n\r\n## License\r\n\r\nMIT\r\n\r\n## CLI Commands\r\n\r\n### `firebase-auth generate`\r\n\r\nGenerate authentication pages and API routes.\r\n\r\n**Options:**\r\n- `-p, --pages <pages>`: Comma-separated list of pages to generate (login, signup, profile)\r\n- `--no-api`: Skip generating API routes\r\n- `-o, --output <path>`: Output directory (default: 'app')\r\n\r\n**Examples:**\r\n```bash\r\n# Generate all auth pages and API routes\r\napi-buddy firebase-auth generate\r\n\r\n# Generate only login and signup pages without API routes\r\napi-buddy firebase-auth generate --pages login,signup --no-api\r\n```\r\n\r\n## Development Status\r\n\r\n### ✅ Implemented\r\n- Page generation (login, signup, profile)\r\n- API route generation for authentication\r\n- Email/password authentication\r\n- Session management\r\n- TypeScript support\r\n- Environment configuration\r\n\r\n### 🚧 In Progress\r\n- OAuth provider setup\r\n- Error handling improvements\r\n- Test coverage\r\n- Documentation\r\n\r\n### 📅 Planned\r\n- Phone authentication\r\n- Multi-factor authentication\r\n- Admin dashboard\r\n- Custom templates\r\n- Social login providers (Google, Facebook, GitHub, etc.)\r\n- Passwordless authentication\r\n\r\n## Installation\r\n\r\n```bash\r\n# Using pnpm (recommended)\r\npnpm add @api-buddy/plugin-auth-firebase firebase\r\n\r\n# Using npm\r\nnpm install @api-buddy/plugin-auth-firebase firebase\r\n\r\n# Using yarn\r\nyarn add @api-buddy/plugin-auth-firebase firebase\r\n```\r\n\r\n## Getting Started\r\n\r\n### 1. Initialize the Plugin\r\n\r\n```typescript\r\nimport { PluginManager } from '@api-buddy/plugin-core';\r\nimport FirebaseAuthPlugin from '@api-buddy/plugin-auth-firebase';\r\n\r\n// Initialize plugin manager\r\nconst pluginManager = new PluginManager();\r\n\r\n// Create and configure the auth plugin\r\nconst authPlugin = new FirebaseAuthPlugin({\r\n  // Required Firebase config\r\n  apiKey: 'your-api-key',\r\n  authDomain: 'your-project.firebaseapp.com',\r\n  projectId: 'your-project-id',\r\n  appId: 'your-app-id',\r\n  \r\n  // Optional Firebase config\r\n  storageBucket: 'your-storage-bucket',\r\n  messagingSenderId: 'your-messaging-sender-id',\r\n  measurementId: 'your-measurement-id',\r\n  \r\n  // Plugin options\r\n  persistence: 'local', // 'local' | 'session' | 'none' (default: 'local')\r\n  enableEmailPassword: true,  // Enable email/password auth (default: true)\r\n  enableGoogleSignIn: false,  // Enable Google OAuth (default: false)\r\n  enableFacebookSignIn: false,// Enable Facebook OAuth (default: false)\r\n  enableTwitterSignIn: false, // Enable Twitter OAuth (default: false)\r\n  enableGithubSignIn: false,  // Enable GitHub OAuth (default: false)\r\n  enablePhoneSignIn: false,   // Enable phone auth (default: false)\r\n  enableAnonymousSignIn: false // Enable anonymous auth (default: false)\r\n});\r\n\r\n// Register the plugin\r\nawait pluginManager.registerPlugin('firebase-auth', authPlugin);\r\n```\r\n\r\n### 2. Using Auth Methods\r\n\r\n```typescript\r\n// Get auth methods from plugin context\r\nconst auth = pluginManager.context?.data.get('auth') as AuthMethods;\r\n\r\n// Sign up a new user\r\ntry {\r\n  const user = await auth.signUpWithEmail('user@example.com', 'secure-password');\r\n  console.log('User created:', user);\r\n} catch (error) {\r\n  console.error('Sign up failed:', error);\r\n}\r\n\r\n// Sign in\r\ntry {\r\n  const user = await auth.signInWithEmail('user@example.com', 'secure-password');\r\n  console.log('Signed in as:', user);\r\n} catch (error) {\r\n  console.error('Sign in failed:', error);\r\n}\r\n\r\n// Sign out\r\ntry {\r\n  await auth.signOut();\r\n  console.log('Signed out');\r\n} catch (error) {\r\n  console.error('Sign out failed:', error);\r\n}\r\n\r\n// Get current user\r\nconst currentUser = auth.getCurrentUser();\r\nconsole.log('Current user:', currentUser);\r\n\r\n// Subscribe to auth state changes\r\nconst unsubscribe = auth.onAuthStateChanged((user) => {\r\n  console.log('Auth state changed:', user ? 'Signed in' : 'Signed out');\r\n  console.log('User details:', user);\r\n});\r\n\r\n// Unsubscribe when done\r\n// unsubscribe();\r\n```\r\n\r\n## API Reference\r\n\r\n### `FirebaseAuthPlugin`\r\n\r\n#### Constructor\r\n\r\n```typescript\r\nnew FirebaseAuthPlugin(config: FirebaseAuthConfig)\r\n```\r\n\r\n**Configuration Options:**\r\n\r\n| Option | Type | Required | Default | Description |\r\n|--------|------|----------|---------|-------------|\r\n| `apiKey` | `string` | Yes | - | Your Firebase API key |\r\n| `authDomain` | `string` | Yes | - | Your Firebase auth domain |\r\n| `projectId` | `string` | Yes | - | Your Firebase project ID |\r\n| `appId` | `string` | Yes | - | Your Firebase app ID |\r\n| `storageBucket` | `string` | No | - | Firebase storage bucket |\r\n| `messagingSenderId` | `string` | No | - | Firebase messaging sender ID |\r\n| `measurementId` | `string` | No | - | Google Analytics measurement ID |\r\n| `persistence` | `'local' | 'session' | 'none'` | No | `'local'` | Auth state persistence mode |\r\n| `enableEmailPassword` | `boolean` | No | `true` | Enable email/password auth |\r\n| `enableGoogleSignIn` | `boolean` | No | `false` | Enable Google OAuth |\r\n| `enableFacebookSignIn` | `boolean` | No | `false` | Enable Facebook OAuth |\r\n| `enableTwitterSignIn` | `boolean` | No | `false` | Enable Twitter OAuth |\r\n| `enableGithubSignIn` | `boolean` | No | `false` | Enable GitHub OAuth |\r\n| `enablePhoneSignIn` | `boolean` | No | `false` | Enable phone auth |\r\n| `enableAnonymousSignIn` | `boolean` | No | `false` | Enable anonymous auth |\r\n\r\n### `AuthMethods` Interface\r\n\r\n```typescript\r\ninterface AuthMethods {\r\n  // Email/Password\r\n  signInWithEmail(email: string, password: string): Promise<FirebaseUser>;\r\n  signUpWithEmail(email: string, password: string): Promise<FirebaseUser>;\r\n  \r\n  // Session\r\n  signOut(): Promise<void>;\r\n  getCurrentUser(): FirebaseUser | null;\r\n  onAuthStateChanged(callback: (user: FirebaseUser | null) => void): () => void;\r\n}\r\n```\r\n\r\n### `FirebaseUser` Interface\r\n\r\n```typescript\r\ninterface FirebaseUser {\r\n  uid: string;\r\n  email: string | null;\r\n  emailVerified: boolean;\r\n  displayName: string | null;\r\n  photoURL: string | null;\r\n  phoneNumber: string | null;\r\n  disabled: boolean;\r\n  metadata: {\r\n    creationTime?: string;\r\n    lastSignInTime?: string;\r\n  };\r\n  providerData: Array<{\r\n    uid: string;\r\n    providerId: string;\r\n    displayName: string | null;\r\n    email: string | null;\r\n    phoneNumber: string | null;\r\n    photoURL: string | null;\r\n  }>;\r\n}\r\n```\r\n\r\n## Error Handling\r\n\r\nAll auth methods return Promises that reject with errors. Common error cases include:\r\n\r\n- `auth/invalid-email`: The email address is invalid\r\n- `auth/user-disabled`: The user account has been disabled\r\n- `auth/user-not-found`: No user found with this email\r\n- `auth/wrong-password`: The password is invalid\r\n- `auth/email-already-in-use`: Email already in use\r\n- `auth/weak-password`: Password is too weak\r\n- `auth/too-many-requests`: Too many failed login attempts\r\n\r\n## License\r\n\r\nMIT © [API Buddy](https://github.com/api-buddy)\r\n","readmeFilename":"README.md"}