Firebase Setup Guide
Firebase Project Information
Project ID: colorize-662df
Credentials File: colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json
Required Firebase Configuration
1. Firebase Admin SDK Credentials ✅
The credentials file is already in the project:
- File:
colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json - The application will automatically detect and use this file
2. Firebase Web API Key (Required for Login/Register)
To get your Firebase Web API Key:
- Go to Firebase Console
- Select your project: colorize-662df
- Click the gear icon ⚙️ → Project settings
- Scroll down to Your apps section
- Find the Web API Key (starts with
AIza...) - Copy this key
Set it as environment variable:
export FIREBASE_API_KEY="AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68"
Or in Hugging Face Spaces:
- Go to Settings → Secrets
- Add secret:
FIREBASE_API_KEY=AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68
3. Firebase App Check Configuration
For App Check to work, you need:
Enable App Check in Firebase Console:
- Go to Firebase Console → App Check
- Register your app
- Choose reCAPTCHA Enterprise provider
- Get your reCAPTCHA Site Key
Frontend Setup:
import { initializeApp } from "firebase/app"; import { initializeAppCheck, ReCaptchaEnterpriseProvider, getToken } from "firebase/app-check"; const firebaseConfig = { apiKey: "AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68", authDomain: "colorize-662df.firebaseapp.com", projectId: "colorize-662df", storageBucket: "colorize-662df.firebasestorage.app", messagingSenderId: "69166278311", appId: "1:69166278311:web:0e8c50b8dd8627aaeadd82", measurementId: "G-58CC2J8XKX" }; const app = initializeApp(firebaseConfig); const appCheck = initializeAppCheck(app, { provider: new ReCaptchaEnterpriseProvider('YOUR_RECAPTCHA_SITE_KEY'), isTokenAutoRefreshEnabled: true }); // Get token for API requests const token = await getToken(appCheck);
Environment Variables
For Local Development:
# Firebase credentials (optional if file is in project root)
export FIREBASE_CREDENTIALS_PATH="./colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json"
# Firebase Web API Key (required for /auth/login and /auth/register)
export FIREBASE_API_KEY="AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68"
# Optional: Disable auth for testing
export DISABLE_AUTH="false"
# Optional: Disable App Check
export ENABLE_APP_CHECK="true"
For Hugging Face Spaces:
Add these as Secrets in Space Settings:
- FIREBASE_CREDENTIALS - Paste the entire contents of
colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json - FIREBASE_API_KEY - Your Web API Key (
AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68) - HF_TOKEN - Your Hugging Face token (for Inference API)
Testing Firebase Connection
Test 1: Health Check (No Auth Required)
curl https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/health
Test 2: Register User (Requires FIREBASE_API_KEY)
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "password123",
"display_name": "Test User"
}'
Test 3: Login (Requires FIREBASE_API_KEY)
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "password123"
}'
Test 4: Colorize with App Check Token
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize \
-H "X-Firebase-AppCheck: YOUR_APP_CHECK_TOKEN" \
-F "file=@image.jpg"
Troubleshooting
Issue: "Firebase not initialized"
Solution: Make sure the credentials file exists and is readable
Issue: "Firebase API key not configured" (for login/register)
Solution: Set FIREBASE_API_KEY environment variable
Issue: "Invalid App Check token"
Solution:
- Make sure App Check is enabled in Firebase Console
- Verify you're sending the token in
X-Firebase-AppCheckheader - Check that reCAPTCHA Enterprise is properly configured
Issue: "Missing App Check token"
Solution:
- Either provide
X-Firebase-AppCheckheader - Or set
ENABLE_APP_CHECK=falseto disable (not recommended for production)
Current Firebase Config
Based on your credentials file:
- Project ID:
colorize-662df - Service Account:
firebase-adminsdk-fbsvc@colorize-662df.iam.gserviceaccount.com - Auth Domain:
colorize-662df.firebaseapp.com - Storage Bucket:
colorize-662df.firebasestorage.app