Your application cannot connect to Firebase because the following required environment variable(s) are missing in your .env.local file:
1. Authorize Your App's Domain (for Published Apps):
If you are seeing an `auth/unauthorized-domain` error after deploying your app, you must add your app's URL to Firebase's list of authorized domains.
2. Check `.env.local` & Project Settings:
Go to your Firebase Console → Project Settings (⚙️) → General tab. Scroll to "Your apps" and find your Web App's configuration. Ensure these values in your .env.local file match exactly:
NEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_API_KEY3. Check Authentication Methods:
In the Firebase Console, go to Build → Authentication → Sign-in method tab. Ensure **Google** sign-in is **Enabled**.
4. Check Firestore (Database):
Go to Build → Firestore Database. Ensure it has been **created** (if not, create one in **Native Mode**). Then, check the **Rules** tab and make sure they allow access, for example: allow read, write: if request.auth != null;
5. Check Cloud Storage:
Go to Build → Storage. Ensure it has been **activated**. Then, check the **Rules** tab and ensure they are also set to allow access: allow read, write: if request.auth != null;
After you create or edit the .env.local file, you must restart the backend in Firebase Studio for the changes to apply.