Delete FIREBASE_SETUP.md
Browse files- FIREBASE_SETUP.md +0 -156
FIREBASE_SETUP.md
DELETED
|
@@ -1,156 +0,0 @@
|
|
| 1 |
-
# Firebase Setup Guide
|
| 2 |
-
|
| 3 |
-
## Firebase Project Information
|
| 4 |
-
|
| 5 |
-
**Project ID:** `colorize-662df`
|
| 6 |
-
**Credentials File:** `colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json`
|
| 7 |
-
|
| 8 |
-
## Required Firebase Configuration
|
| 9 |
-
|
| 10 |
-
### 1. Firebase Admin SDK Credentials ✅
|
| 11 |
-
The credentials file is already in the project:
|
| 12 |
-
- File: `colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json`
|
| 13 |
-
- The application will automatically detect and use this file
|
| 14 |
-
|
| 15 |
-
### 2. Firebase Web API Key (Required for Login/Register)
|
| 16 |
-
|
| 17 |
-
To get your Firebase Web API Key:
|
| 18 |
-
|
| 19 |
-
1. Go to [Firebase Console](https://console.firebase.google.com/)
|
| 20 |
-
2. Select your project: **colorize-662df**
|
| 21 |
-
3. Click the gear icon ⚙️ → **Project settings**
|
| 22 |
-
4. Scroll down to **Your apps** section
|
| 23 |
-
5. Find the **Web API Key** (starts with `AIza...`)
|
| 24 |
-
6. Copy this key
|
| 25 |
-
|
| 26 |
-
**Set it as environment variable:**
|
| 27 |
-
```bash
|
| 28 |
-
export FIREBASE_API_KEY="AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68"
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
Or in Hugging Face Spaces:
|
| 32 |
-
- Go to Settings → Secrets
|
| 33 |
-
- Add secret: `FIREBASE_API_KEY` = `AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68`
|
| 34 |
-
|
| 35 |
-
### 3. Firebase App Check Configuration
|
| 36 |
-
|
| 37 |
-
For App Check to work, you need:
|
| 38 |
-
|
| 39 |
-
1. **Enable App Check in Firebase Console:**
|
| 40 |
-
- Go to Firebase Console → **App Check**
|
| 41 |
-
- Register your app
|
| 42 |
-
- Choose **reCAPTCHA Enterprise** provider
|
| 43 |
-
- Get your **reCAPTCHA Site Key**
|
| 44 |
-
|
| 45 |
-
2. **Frontend Setup:**
|
| 46 |
-
```javascript
|
| 47 |
-
import { initializeApp } from "firebase/app";
|
| 48 |
-
import { initializeAppCheck, ReCaptchaEnterpriseProvider, getToken } from "firebase/app-check";
|
| 49 |
-
|
| 50 |
-
const firebaseConfig = {
|
| 51 |
-
apiKey: "AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68",
|
| 52 |
-
authDomain: "colorize-662df.firebaseapp.com",
|
| 53 |
-
projectId: "colorize-662df",
|
| 54 |
-
storageBucket: "colorize-662df.firebasestorage.app",
|
| 55 |
-
messagingSenderId: "69166278311",
|
| 56 |
-
appId: "1:69166278311:web:0e8c50b8dd8627aaeadd82",
|
| 57 |
-
measurementId: "G-58CC2J8XKX"
|
| 58 |
-
};
|
| 59 |
-
|
| 60 |
-
const app = initializeApp(firebaseConfig);
|
| 61 |
-
|
| 62 |
-
const appCheck = initializeAppCheck(app, {
|
| 63 |
-
provider: new ReCaptchaEnterpriseProvider('YOUR_RECAPTCHA_SITE_KEY'),
|
| 64 |
-
isTokenAutoRefreshEnabled: true
|
| 65 |
-
});
|
| 66 |
-
|
| 67 |
-
// Get token for API requests
|
| 68 |
-
const token = await getToken(appCheck);
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
## Environment Variables
|
| 72 |
-
|
| 73 |
-
### For Local Development:
|
| 74 |
-
```bash
|
| 75 |
-
# Firebase credentials (optional if file is in project root)
|
| 76 |
-
export FIREBASE_CREDENTIALS_PATH="./colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json"
|
| 77 |
-
|
| 78 |
-
# Firebase Web API Key (required for /auth/login and /auth/register)
|
| 79 |
-
export FIREBASE_API_KEY="AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68"
|
| 80 |
-
|
| 81 |
-
# Optional: Disable auth for testing
|
| 82 |
-
export DISABLE_AUTH="false"
|
| 83 |
-
|
| 84 |
-
# Optional: Disable App Check
|
| 85 |
-
export ENABLE_APP_CHECK="true"
|
| 86 |
-
```
|
| 87 |
-
|
| 88 |
-
### For Hugging Face Spaces:
|
| 89 |
-
Add these as **Secrets** in Space Settings:
|
| 90 |
-
|
| 91 |
-
1. **FIREBASE_CREDENTIALS** - Paste the entire contents of `colorize-662df-firebase-adminsdk-fbsvc-bfd21c77c6.json`
|
| 92 |
-
2. **FIREBASE_API_KEY** - Your Web API Key (`AIzaSyBIB6rcfyyqy5niERTXWvVD714Ter4Vx68`)
|
| 93 |
-
3. **HF_TOKEN** - Your Hugging Face token (for Inference API)
|
| 94 |
-
|
| 95 |
-
## Testing Firebase Connection
|
| 96 |
-
|
| 97 |
-
### Test 1: Health Check (No Auth Required)
|
| 98 |
-
```bash
|
| 99 |
-
curl https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/health
|
| 100 |
-
```
|
| 101 |
-
|
| 102 |
-
### Test 2: Register User (Requires FIREBASE_API_KEY)
|
| 103 |
-
```bash
|
| 104 |
-
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/auth/register \
|
| 105 |
-
-H "Content-Type: application/json" \
|
| 106 |
-
-d '{
|
| 107 |
-
"email": "test@example.com",
|
| 108 |
-
"password": "password123",
|
| 109 |
-
"display_name": "Test User"
|
| 110 |
-
}'
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
### Test 3: Login (Requires FIREBASE_API_KEY)
|
| 114 |
-
```bash
|
| 115 |
-
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/auth/login \
|
| 116 |
-
-H "Content-Type: application/json" \
|
| 117 |
-
-d '{
|
| 118 |
-
"email": "test@example.com",
|
| 119 |
-
"password": "password123"
|
| 120 |
-
}'
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
### Test 4: Colorize with App Check Token
|
| 124 |
-
```bash
|
| 125 |
-
curl -X POST https://logicgoinfotechspaces-text-guided-image-colorization.hf.space/colorize \
|
| 126 |
-
-H "X-Firebase-AppCheck: YOUR_APP_CHECK_TOKEN" \
|
| 127 |
-
-F "file=@image.jpg"
|
| 128 |
-
```
|
| 129 |
-
|
| 130 |
-
## Troubleshooting
|
| 131 |
-
|
| 132 |
-
### Issue: "Firebase not initialized"
|
| 133 |
-
**Solution:** Make sure the credentials file exists and is readable
|
| 134 |
-
|
| 135 |
-
### Issue: "Firebase API key not configured" (for login/register)
|
| 136 |
-
**Solution:** Set `FIREBASE_API_KEY` environment variable
|
| 137 |
-
|
| 138 |
-
### Issue: "Invalid App Check token"
|
| 139 |
-
**Solution:**
|
| 140 |
-
1. Make sure App Check is enabled in Firebase Console
|
| 141 |
-
2. Verify you're sending the token in `X-Firebase-AppCheck` header
|
| 142 |
-
3. Check that reCAPTCHA Enterprise is properly configured
|
| 143 |
-
|
| 144 |
-
### Issue: "Missing App Check token"
|
| 145 |
-
**Solution:**
|
| 146 |
-
- Either provide `X-Firebase-AppCheck` header
|
| 147 |
-
- Or set `ENABLE_APP_CHECK=false` to disable (not recommended for production)
|
| 148 |
-
|
| 149 |
-
## Current Firebase Config
|
| 150 |
-
|
| 151 |
-
Based on your credentials file:
|
| 152 |
-
- **Project ID:** `colorize-662df`
|
| 153 |
-
- **Service Account:** `firebase-adminsdk-fbsvc@colorize-662df.iam.gserviceaccount.com`
|
| 154 |
-
- **Auth Domain:** `colorize-662df.firebaseapp.com`
|
| 155 |
-
- **Storage Bucket:** `colorize-662df.firebasestorage.app`
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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