-
Notifications
You must be signed in to change notification settings - Fork 0
Google Application Credentials
Remember, documentation is king. For the full official reference, see Firebase App Distribution.
This guide walks you through generating a Google service account credentials file and securely adding it to your project.
- A Google Cloud project already created
- Access to the Google Cloud Console
- Firebase CLI or access to your project's secret manager
Navigate to the IAM & Admin > Service Accounts page:
👉 https://console.cloud.google.com/projectselector2/iam-admin/serviceaccounts
Select your project from the project selector if prompted.
- Click "Create Service Account"
- Fill in the required fields:
-
Name — a descriptive name (e.g.,
my-app-service-account) - ID — auto-generated, but can be customized
- Description (optional but recommended) — briefly describe the account's purpose
-
Name — a descriptive name (e.g.,
- Click "Create and Continue"
Grant the service account the roles it needs. Common roles include:
-
Firebase Hosting Admin— for Firebase Hosting operations
⚠️ Follow the principle of least privilege — only grant the roles your application actually needs.
Click "Continue", then "Done".
- From the Service Accounts list, click on your newly created account
- Go to the "Keys" tab
- Click "Add Key" > "Create new key"
- Choose JSON as the key type
- Click "Create" — the file will download automatically as
credentials.json
🔒 Keep this file private. Never commit it to version control.
Convert the JSON file into a Base64 string so it can be stored safely as a secret:
# macOS / Linux
base64 -I credentials.json | pbcopy
- Go to Your repository > Settings > Secret and variables > Actions on Github
- Click "New repository secret"
- Name it
GOOGLE_APPLICATION_CREDENTIALS - Paste the Base64 string as the secret value
- Click "Create"
In your application, decode the secret at runtime:
[...]
jobs:
ci:
name: Build & Verify
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Prepare, test and deploy flutter web app
uses: Spaccesi/flutter-actions-suite@main
with:
[...]
firebase-service-account-base64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}| Step | Action |
|---|---|
| 1 | Open Service Accounts in Google Cloud Console |
| 2 | Create a new service account |
| 3 | Assign the appropriate roles |
| 4 | Download the JSON key file |
| 5 | Encode it with Base64 |
| 6 | Store it as a secret named GOOGLE_APPLICATION_CREDENTIALS
|
| 7 | Add it to firebase-service-account-base64 input on the job |
@