Authenticating with Google services using a service account
How to set up a service account for authentication with Google Play and Firebase
A service account is required when setting up publishing to Google Play or Firebase App Distribution or running tests on Firebase Test Lab. The service account JSON key file must be added to Codemagic to authenticate with these services. This document describes how to create a service account, follow the guides of each integration for details on how to add the JSON key file to Codemagic.
To allow Codemagic to publish applications to Google Play, it is necessary to set up access using Google Play API.
In Google Play Console, navigate to Settings > API access and click Create new service account.
This will lead you to the Google Cloud Platform. Please follow the steps in this guide to create a service account with the required role in Google Cloud Platform. Note that Editor role is required for Google Play.
Back in Google Play Console, navigate to Settings > API access and click Grant access next to the created account.
On the App permissions tab, add the applications you wish to grant access to.
Go with the default settings for app permissions and click Apply (financial data permissions can be left blank).
On the Account permissions tab, leave everything as is (there is no need to grant the service account Admin access).
Finally, click Invite user to finish setting up the service account on Google Play.
A service account can be used to authenticate with various Firebase services, such as Firebase Test Lab and Firebase App Distribution.
On the Firebase project page, navigate to Project settings by clicking on the cog button. Select the Service accounts tab. Click on the X service accounts button as shown on the screenshot.
This will lead you to the Google Cloud Platform. Please follow the steps in this guide to create a service account with the required role in Google Cloud Platform. Note that Editor role is required for Firebase Test Lab and Firebase App Distribution Admin for Firebase App Distribution.
Creating a service account
Start creating your service account by clicking + Create service account at the top of the page.
In step 1, fill in the Service account details and click Create. The name of the service account will allow you to identify it among other service accounts you may have created.
In step 2, click the Select a role dropdown menu and choose the role. In this example we will use Editor as the desired role. Start typing the name of the role that you wish to add.
In step 3, you can leave the fields blank and click Done.
In the list of created service accounts, identify the account you have just created and click on the menu in the Actions column, then click Manage keys.
In the Keys section, click Add Key > Create new key. Make sure that the key type is set to
JSONand click Create. Save the key file in a secure location to have it available.