diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/01-iam-admin-page.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/01-iam-admin-page.png new file mode 100644 index 0000000..50f1797 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/01-iam-admin-page.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-1.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-1.png new file mode 100644 index 0000000..42eb2e8 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-1.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-2.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-2.png new file mode 100644 index 0000000..ad3a0eb Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-2.png differ diff --git a/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-3.png b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-3.png new file mode 100644 index 0000000..2ffebb2 Binary files /dev/null and b/assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-3.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..c41ff4f 100644 --- a/creating-google-service-account.md +++ b/creating-google-service-account.md @@ -1,6 +1,21 @@ -# 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 +58,59 @@ 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 [IAM Admin page](https://console.cloud.google.com/iam-admin/iam?authuser=0) in Google Cloud Console. In the Permissions tab, locate the Principal you intend to modify and click the pencil icon for **Edit Principal**. + +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/01-iam-admin-page.png) + +2. Click **Add Role** and select the `Firebase Messaging API Admin` role from the dropdown. Click **Save**. + +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-1.png) +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-2.png) +[](./assets/creating-google-service-account/fcm-v1/existing-service-account/02-add-role-3.png) + +3. Tell EAS which JSON credential file to use for sending FCM V1 notifications, either via EAS CLI or the [expo.dev](https://expo.dev) website. You can upload a new JSON file or select a previously uploaded file. + - 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) +