# Play Store credentials

How to create a Google Cloud service account for the Google Play Android Developer API, grant it access in the Play Console, and store the JSON key in the platform.

> Source: https://www.application-platform.com/en/docs/play-store-credentials/

The platform publishes Android builds through the Google Play Android Developer API with a **service account** from Google Cloud whose JSON key you store. You need a developer account in the Play Console that may manage API access and users; the registration is described under [Google Play developer account]({{< relref "google-play-developer-account" >}}).

## Enable the APIs and link a Google Cloud project

1. Open the [Google Play Console](https://play.google.com/console/) and go to **Settings** (gear) → **API access**.
2. Link a **Google Cloud project** or accept the suggestion.
3. Enable the **Google Play Android Developer API** on the linked project, through the link from the Play Console or directly in the [Google Cloud Console](https://console.cloud.google.com/).
4. Also enable the **Google Play Developer Reporting API**, which the platform uses to load your apps and package names for the selection list; without it the list stays empty.

## Create the service account and JSON key

1. In the Google Cloud Console, go to **IAM & Admin** → **Service Accounts** → **Create service account** in the linked project.
2. Give it a descriptive name such as `application-platform-play`.
3. In the new service account, choose **Keys** → **Add key** → **Create new key** with the type **JSON**.
4. Download the JSON file and keep it in a safe place.

## Grant the service account access in the Play Console

1. In the Play Console, go to **API access** or **Users and permissions**.
2. Add the service account as a user with the email address from the `client_email` field of the JSON file.
3. Assign the permissions your pipelines need, usually the rights to manage releases.

Without this step the platform can sign in to Google, but every upload to the Play Console fails.

## Enter the JSON key in the platform

Open **Store accounts**, click **Add access**, choose the Play Store account, and paste the full contents of the JSON file into the **Play Store accounts JSON** field. Click **Verify credentials** first. On success the platform shows the service account's email address and, where available, the project ID; only then can the entry be saved.

If you later replace the key in Google Cloud, update the entry with the new JSON.

## Package name of the app

In the app you select the **Android application ID**, that is the package name, from the apps of the Play Store account; you create new apps in the Play Console as described under [Play Store: Create an app and package name]({{< relref "play-store-package-names" >}}).

