Authenticate with a service account

Service accounts are useful for setting up App Distribution in a CI environment. Authenticating with a service account allows you to use client libraries (e.g., the Firebase CLI or fastlane) to distribute your builds. When you use a service account to authenticate, Firebase uses Application Default Credentials (ADC) to locate your app's credentials, which you can provide by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable.

  1. Open the Google Cloud console and select your project.
  2. Click Create Service Account and enter service account details.
  3. Click Create and Continue.
  4. Add the Firebase App Distribution Admin role and click Done.
  5. Create a private JSON key and move the key to a location accessible to your build environment. Be sure to keep this file somewhere safe, because it grants administrator access to App Distribution in your Firebase project.
  6. Skip this step if you created your app after September 20, 2019: In the Google APIs console, enable the Firebase App Distribution API. When prompted, select the project with the same name as your Firebase project.
  7. Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path of your private key JSON file:
    export GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/credentials/file.json