-
Notifications
You must be signed in to change notification settings - Fork 1
Firebase Service Account Setup
Sk Niyaj Ali edited this page Dec 25, 2024
·
3 revisions
- Firebase project admin access
- Google Cloud Console access
- Project owner or editor role
-
Access Google Cloud Console
- Go to Google Cloud Console
- Select your Firebase project
- Ensure you're using the same project as your Firebase app
-
Navigate to Service Accounts
- In the left sidebar, go to "IAM & Admin" > "Service Accounts"
- Look for the existing Firebase Admin SDK service account or create a new one
-
Create a New Service Account
- Click "CREATE SERVICE ACCOUNT"
- Fill in the details:
- Name:
firebase-ci-service-account
- ID: Will be auto-generated
- Description: "Service account for CI/CD deployments"
- Name:
- Click "CREATE AND CONTINUE"
-
Grant Required Permissions
- Add the following roles:
- Firebase Admin
- Firebase App Distribution Admin (if using App Distribution)
- Firebase Hosting Admin (if using Hosting)
- Firebase Test Lab Admin (if using Test Lab)
- Click "CONTINUE"
- Add the following roles:
-
Generate Key File
- Click on the newly created service account
- Go to the
"KEYS"
tab - Click
"ADD KEY" > "Create new key"
- Choose JSON format
- Click
"CREATE"
- The key file will be automatically downloaded
- Keep this file secure and never commit it to version control
-
Encode Service Account Key
On macOS/Linux:
base64 -i path/to/service-account-key.json
On Windows (PowerShell):
[Convert]::ToBase64String([System.IO.File]::ReadAllBytes("path/to/service-account-key.json"))
Or navigate to the website to encode or decode here
-
Add to GitHub Secrets
- Go to your GitHub repository
- Navigate to Settings > Secrets and variables > Actions
- Click "New repository secret"
- Name:
FIREBASE_SERVICE_ACCOUNT
- Value: Paste the Base64 encoded string
- Click "Add secret"