diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/01-service-accounts-page.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/01-service-accounts-page.png new file mode 100644 index 0000000..5e7e79b Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/01-service-accounts-page.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role.png new file mode 100644 index 0000000..6d67fbf Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-1.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-1.png new file mode 100644 index 0000000..07312ca Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-1.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-2.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-2.png new file mode 100644 index 0000000..69e81c3 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-2.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-3.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-3.png new file mode 100644 index 0000000..50ff7ae Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-3.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/04-upload-credential-complete.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/04-upload-credential-complete.png new file mode 100644 index 0000000..83882b3 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/04-upload-credential-complete.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/01-new-firebase-project.png b/assets/creating-google-service-account/fcm-v1/new-service-account/01-new-firebase-project.png new file mode 100644 index 0000000..25af597 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/01-new-firebase-project.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/02-manage-service-accounts.png b/assets/creating-google-service-account/fcm-v1/new-service-account/02-manage-service-accounts.png new file mode 100644 index 0000000..f21c752 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/02-manage-service-accounts.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/03-generate-key.png b/assets/creating-google-service-account/fcm-v1/new-service-account/03-generate-key.png new file mode 100644 index 0000000..198d5a8 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/03-generate-key.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png new file mode 100644 index 0000000..07312ca Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png new file mode 100644 index 0000000..69e81c3 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-3.png b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-3.png new file mode 100644 index 0000000..50ff7ae Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-3.png differ diff --git a/assets/creating-google-service-account/fcm-v1/new-service-account/05-upload-credential-complete.png b/assets/creating-google-service-account/fcm-v1/new-service-account/05-upload-credential-complete.png new file mode 100644 index 0000000..83882b3 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/new-service-account/05-upload-credential-complete.png differ diff --git a/creating-google-service-account.md b/creating-google-service-account.md index f23024a..b479a25 100644 --- a/creating-google-service-account.md +++ b/creating-google-service-account.md @@ -1,6 +1,20 @@ -# Creating a Google Service Account +# Using a Google Service Account Key with EAS -If you’d like to submit your Android app to Google Play Store with `eas submit` you need to create a Google Service Account key. To do this, the following steps are required: +A Google Service Account Key is a credential in the form of a JSON file that you can obtain via Google Cloud for a particular Google Service Account. + +EAS requires a Google Service Account Key to be uploaded and configured for the following use cases: + +1. submitting your Android app to Google Play Store with `eas submit` +2. sending Android notifications via `api.expo.dev/push/send` using the FCM V1 protocol + - note: beginning in June 2024, all Android notifications must be sent using the FCM V1 protocol + +You can configure separate Google Service Account Keys for each of these use cases, or upload a single Google Service Account Key and use it for both use cases (provided that the correct authorizations are in place for that Service Account in Google Cloud Console). + +The steps for each use case are detailed below. + + ## Uploading a Google Service Account Key for Play Store Submissions + + To set up a Google Service Account Key for Play Store Submissions via `eas submit`, the following steps are required: - Create a Google Cloud project (optional if you already have one) - Create a Google Service Account and create and download the JSON key file @@ -43,3 +57,57 @@ If you’d like to submit your Android app to Google Play Store with `eas submit [](./assets/creating-google-service-account/11-account-permissions.png) 9. That's all! From now on, you can use the generated Google Service Account key to upload your app with `eas submit`. + +## Using a Google Service Account Key for Sending Android Notifications via FCM V1 + +Here are the steps to set up a Google Service Account Key for sending Android Notifications via FCM V1. + +### Configuring a new Google Service Account Key for Android Notifications using FCM V1 + +Here are the steps to configure a new Google Service Account Key in EAS for sending Android Notifications using FCM V1. + +1. (If you already have a Firebase project for your app, continue to the next step.) Create a new Firebase project for your app in the [Firebase Console](https://console.firebase.google.com) + +[](./assets/creating-google-service-account/fcm-v1/new-service-account/01-new-firebase-project.png) + +2. In the Firebase console, open Settings > [Service Accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk) for your project + +[](./assets/creating-google-service-account/fcm-v1/new-service-account/02-manage-service-accounts.png) + +3. Click **Generate New Private Key**, then confirm by clicking **Generate Key**. Securely store the JSON file containing the private key. + +[](./assets/creating-google-service-account/fcm-v1/new-service-account/03-generate-key.png) + +4. Upload the JSON file to EAS and configure it for sending Android notifications. This can be done in EAS CLI or via [expo.dev](https://expo.dev). + - using EAS CLI: run `eas credentials` > `Android` > `production` > `Google Service Accounts` > `FCM V1` + - using [expo.dev](https://expo.dev): navigate to credentials page for your project (`expo.dev/accounts//projects//credentials`) > click on the Android application identifier > find the section entitled "FCM V1 service account key" > click **Add a service account key** > upload your JSON credential and click **Save** + +[](./assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-1.png) +[](./assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-2.png) +[](./assets/creating-google-service-account/fcm-v1/new-service-account/04-upload-credential-3.png) + +5. You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol. +[](./assets/creating-google-service-account/fcm-v1/new-service-account/05-upload-credential-complete.png) + + +### Using an existing Google Service Account Key to Send Android Notifications using FCM V1 + +1. Open the [Service Accounts page](https://console.cloud.google.com/iam-admin/serviceaccounts) in the Google Cloud Console. + +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/01-service-accounts-page.png) + +2. Add the following role to the service account you wish to use for FCM V1 notifications: `Firebase Messaging API Admin`. + +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role.png) + +3. Specify the JSON key file corresponding to this service account for use in FCM V1 notifications. If you've already uploaded the JSON file for this service account to EAS (e.g. for Play Store Submissions), use the `Select Existing Key` option in EAS CLI or in the web UI at [expo.dev](https://expo.dev). If you haven't yet uploaded the JSON file for this service account, upload the JSON file for this service account to EAS and configure it for sending Android notifications. + - using EAS CLI: run `eas credentials` > `Android` > `production` > `Google Service Accounts` > `FCM V1` + - using [expo.dev](https://expo.dev): navigate to credentials page for your project (`expo.dev/accounts//projects//credentials`) > click on the Android application identifier > find the section entitled "FCM V1 service account key" > click **Add a service account key** > upload your JSON credential and click **Save** + +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-1.png) +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-2.png) +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/03-upload-credential-3.png) + +4. You're all set! You can now send notifications to Android devices via Expo Push Notifications using the FCM V1 protocol. +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/04-upload-credential-complete.png) +