Catch up on everything announced at Firebase Summit, and learn how Firebase can help you accelerate app development and run your app with confidence. Learn More

Authenticate with a service account

Stay organized with collections Save and categorize content based on your preferences.

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, Gradle, and 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 either setting the GOOGLE_APPLICATION_CREDENTIALS environment variable or by pointing to the path of your service account key in your app's code.

  1. On the Google Cloud Console, select your project and create a new service account.
  2. Add the Firebase App Distribution Admin role.
  3. 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, as it grants administrator access to App Distribution in your Firebase project.
  4. 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.

  5. Provide your service account credentials:

    • For Gradle only: In your build.gradle file, set the property serviceCredentialsFile to your private key JSON file:

      android {
          // ...
          buildTypes {
              release {
                  firebaseAppDistribution {
          // ...

      Optionally, you can provide credentials to your app's code instead by following the step below.

    • For the Firebase CLI, fastlane, or Gradle: 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