Google Firebase zwingend erforderlich für den Empfang von Push-Nachrichten?

Ich beobachte immer öfter die Verwendung von Google Firebase – eine Entwicklungs-Plattform für mobile Apps und Webanwendungen, die von Google angeboten wird. Man kann sich Google Firebase wie einen digitalen Werkzeugkasten für Entwickler vorstellen, aus dem das passende Tool einfach herausgenommen werden kann. Aktuell bietet Google eine Vielzahl von Tools und Diensten (aktuell 18), die sich schnell und einfach in Apps integrieren lassen, einschließlich Echtzeit-Datenbanken, Benutzer-Authentifizierung, Cloud-Speicher und mehr.

Ebenfalls Bestandteil von Google Firebase ist Firebase Cloud Messaging (FCM), mit dem sich Push-Nachrichten bzw. Benachrichtigungen innerhalb von Apps empfangen lassen. Bis dato war es meines Wissens allerdings nicht notwendig für die Nutzung von FCM zwingend Google Firebase einzusetzen bzw. dies zu initialisieren.

Nachfolgend ein Beispiel. Eine App möchte sich bei FCM registrieren, um Benachrichtigungen empfangen zu können. Das sieht wie folgt aus:

POST /c2dm/register3 HTTP/1.1
Authorization: AidLogin 3868886209058190204:2966639822192392558
app: de.beispiel.app
gcm_ver: 231312030
app_ver: 470010042
User-Agent: Android-GCM/1.5 (tissot QQ3A.200805.001)
Content-Length: 766
content-type: application/x-www-form-urlencoded
Host: android.apis.google.com
Connection: close
Accept-Encoding: gzip, deflate

X-subtype=496639497960&
sender=496639497960&
X-app_ver=470010042&
X-osv=29&
X-cliv=fcm-22.0.0&
X-gmsv=231312030&
X-appid=cZ6_lvTuQbChDP3FMGPAp-&
X-scope=*&
X-gmp_app_id=1:496639497960:android:d46924e48a7cb40844db5d&
X-Firebase-Client=device-model/tissot kotlin/1.7.10 fire-core/20.0.0 fire-android/29 device-name/lineage_tissot android-installer/com.android.vending fire-installations/17.0.0 fire-fcm/22.0.0 android-min-sdk/21 android-platform/ device-brand/Xiaomi android-target-sdk/33&
X-firebase-app-name-hash=R1fAH8UiUM-znoznwBdw01tLxLI&
X-Firebase-Client-Log-Type=1&
X-app_ver_name=1.0.0&
app=de.beispiel.app&
device=3868886209058190204&
app_ver=470010042&
gcm_ver=231312030&
plat=0&
cert=1f18f7abbe32d53e2e972c75fe18bd486b64c6b5&
target_ver=33

Als Meldung erhält die App allerdings folgende Nachricht, da ich die vorausgehende Registrierung bei Google Firebase (firebaseinstallations.googleapis.com) blockiert habe:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Date: Thu, 04 May 2023 12:50:50 GMT
Expires: Thu, 04 May 2023 12:50:50 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Connection: close
Content-Length: 20

Error=FIS_AUTH_ERROR

Nachfolgend das Szenario nochmals, allerdings mit erlaubter Kontaktaufnahme zu Google Firebase, um sich das notwendige Auth-Token abzuholen. Folgende Anfrage geht initial an Google Firebase raus:

POST /v1/projects/vvpapp-de35a/installations HTTP/1.1
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache
X-Android-Package: de.beispiel.app
x-firebase-client: device-model/tissot kotlin/1.7.10 fire-core/20.0.0 fire-android/29 device-name/lineage_tissot android-installer/com.android.vending fire-installations/17.0.0 fire-fcm/22.0.0 android-min-sdk/21 android-platform/ device-brand/Xiaomi android-target-sdk/33
x-firebase-client-log-type: 3
X-Android-Cert: 1F18F7ABBE32D53E2E972C75FE18BD486B64C6B5
x-goog-api-key: AIzaSyCWb3dklXRmVf7GyWRc8CD6vmUV3TEbEb4
User-Agent: Dalvik/2.1.0 (Linux; U; Android 10; Mi A1 Build/QQ3A.200805.001)
Host: firebaseinstallations.googleapis.com
Connection: close
Accept-Encoding: gzip, deflate
Content-Length: 135

{
   "fid":"eTUHiN1gQCOwtNseObCbhP",
   "appId":"1:496639497960:android:d46924e48a7cb40844db5d",
   "authVersion":"FIS_v2",
   "sdkVersion":"a:17.0.0"
}

Die Antwort lautete wie folgt:

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Vary: Origin
Vary: X-Origin
Vary: Referer
Date: Thu, 04 May 2023 12:49:14 GMT
Server: ESF
Cache-Control: private
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Connection: close
Content-Length: 630

{
  "name": "projects/496639497960/installations/eTUHiN1gQCOwtNseObCbhP",
  "fid": "eTUHiN1gQCOwtNseObCbhP",
  "refreshToken": "3_AS3qfwJeLVFkBz0i20fx8wNpD5XeRDkR3FRtGoTHjMV28nR-fIO_dqkXAc2ptSGF-l_m4M5fr3j1_46SEOEMfsfpelsLSJTifzXpVE4flwO8sUY",
  "authToken": {
    "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjE6NDk2NjM5NDk3OTYwOmFuZHJvaWQ6ZDQ2OTI0ZTQ4YTdjYjQwODQ0ZGI1ZCIsImV4cCI6MTY4MzgwOTM1NCwiZmlkIjoiZVRVSGlOMWdRQ093dE5zZU9iQ2JoUCIsInByb2plY3ROdW1iZXIiOjQ5NjYzOTQ5Nzk2MH0.AB2LPV8wRQIhALkdYWgyFqqgOxVNLnl2fclhjLPQjKmfMWkA8ZW-2eF8AiBBebXBYXPB3ZHAE2DCd9sykHHBjxaQsJE37-4u5DtXUg",
    "expiresIn": "604800s"
  }
}

Dieses Auth-Token (eyJhbGciOiJFUzI1NiIsInR5cCI6Ik[..]) ist nun Teil der Anfrage bei FCM:

POST /c2dm/register3 HTTP/1.1
Authorization: AidLogin 3868886209058190204:2966639822192392558
app: de.beispiel.app
gcm_ver: 231312030
app_ver: 470010042
User-Agent: Android-GCM/1.5 (tissot QQ3A.200805.001)
Content-Length: 1121
content-type: application/x-www-form-urlencoded
Host: android.apis.google.com
Connection: close
Accept-Encoding: gzip, deflate

X-subtype=496639497960&
sender=496639497960&
X-app_ver=470010042&
X-osv=29&
X-cliv=fcm-22.0.0&
X-gmsv=231312030&
X-appid=eTUHiN1gQCOwtNseObCbhP&
X-scope=*&
X-Goog-Firebase-Installations-Auth=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjE6NDk2NjM5NDk3OTYwOmFuZHJvaWQ6ZDQ2OTI0ZTQ4YTdjYjQwODQ0ZGI1ZCIsImV4cCI6MTY4MzgwOTM1NCwiZmlkIjoiZVRVSGlOMWdRQ093dE5zZU9iQ2JoUCIsInByb2plY3ROdW1iZXIiOjQ5NjYzOTQ5Nzk2MH0.AB2LPV8wRQIhALkdYWgyFqqgOxVNLnl2fclhjLPQjKmfMWkA8ZW-2eF8AiBBebXBYXPB3ZHAE2DCd9sykHHBjxaQsJE37-4u5DtXUg&
X-gmp_app_id=1:496639497960:android:d46924e48a7cb40844db5d&
X-Firebase-Client=device-model/tissot kotlin/1.7.10 fire-core/20.0.0 fire-android/29 device-name/lineage_tissot android-installer/com.android.vending fire-installations/17.0.0 fire-fcm/22.0.0 android-min-sdk/21 android-platform/ device-brand/Xiaomi android-target-sdk/33&
X-firebase-app-name-hash=R1fAH8UiUM-znoznwBdw01tLxLI&
X-Firebase-Client-Log-Type=1&
X-app_ver_name=1.0.0&
app=de.beispiel.app&
device=3868886209058190204&
app_ver=470010042&
gcm_ver=231312030&
plat=0&
cert=1f18f7abbe32d53e2e972c75fe18bd486b64c6b5&
target_ver=33

Die Antwort endet dann nicht mit der Fehlermeldung (FIS_AUTH_ERROR), sondern wird wie folgt beantwortet:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Date: Thu, 04 May 2023 12:49:15 GMT
Expires: Thu, 04 May 2023 12:49:15 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Connection: close
Content-Length: 169

token=eTUHiN1gQCOwtNseObCbhP:APA91bGd2Tkhw-Y_VOMDeKLebn5ZfTUYcPe1yWzKXETGrkGPllTxgWUp6E-ktwPJ1Fq6LrYshFz-dLC8E0WuFNG4kVAg6ecvt7TgfkzjG3OyAhooov0dQlp13aVRKuX0GPFH-0YGZoVL

Was die beiden FCM-Anfrage nun unterscheidet ist folgender Parameter:

X-Goog-Firebase-Installations-Auth=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjE6NDk2NjM5NDk3OTYwOmFuZHJvaWQ6ZDQ2OTI0ZTQ4YTdjYjQwODQ0ZGI1ZCIsImV4cCI6MTY4MzgwOTM1NCwiZmlkIjoiZVRVSGlOMWdRQ093dE5zZU9iQ2JoUCIsInByb2plY3ROdW1iZXIiOjQ5NjYzOTQ5Nzk2MH0.AB2LPV8wRQIhALkdYWgyFqqgOxVNLnl2fclhjLPQjKmfMWkA8ZW-2eF8AiBBebXBYXPB3ZHAE2DCd9sykHHBjxaQsJE37-4u5DtXUg

Die Frage an die Anroid-Entwickler ist nun: Ist Google Firebase mittlerweile eine zwingende Voraussetzung, um über Firebase Cloud Messaging (FCM) Benachrichtigungen empfangen zu können? Oder kann man das auch Umgehen bzw. die initiale Registrierung bei Google Firebase auch weglassen? Wäre schön, wenn das ein Entwickler beantworten könnte.

Unterstütze den Blog mit einem Dauerauftrag! Mitmachen ➡