[SOLVED] Notifications not working in AAB build: Fetching the token failed: FIS_AUTH_ERROR. Code: E_REGISTRATION_FAILED.

Please provide the following:

  1. SDK Version: 41
  2. Platforms(Android/iOS/web/all): Android (AAB)
  3. Managed workflow

Hi! I decided to make my own thread because I just can’t get it to work and I can not find any thread/google with a solution.

As the title says, I’m getting push notifications and tokens on iOS, Expo Go, Android APK (locally) but not standalone Android AAB/APK published to the store (internal test). I’m using the expo-notifications snack which should work.*

  • google-services.json is setup correctly in app.json.
  • package names match.
  • Compared upload/signing keys from play store (app integrity) to Expo/Firebase.
  • Added my upload/signing sha-1/sha-256 key to Firebase.
  • Added my upload/signing sha-1 key to google cloud API key, unrestricted service access for now.
  • Done some logging: getExpoPushTokenAsync() returns undefined in standalone AAB/APK published in store (internal test), no error.
  • Uploaded Firebase server key expo push:android:upload --api-key <Server key>
  • Checked/matched keys Expo vs Firebase.
  • Checked several physical devices (Pixel 5/OnePlus 6T) for notification permissions.
  • Cleared expo cache before making a new build.
  • Read all of google and these forums xD. No seriously, I’m at a loss here.

Update:
I finally managed to produce an error from getExpoPushTokenAsync() ! I also installed Sentry but that’s not displaying it.

The error: Error: Fetching the token failed: FIS_AUTH_ERROR . I’ve done a quick search on the expo forums and I figured it could be that I’m doing something wrong regarding app signing or it’s a bug in Expo? Fetching the token Failed, message : FIS_AUTH_ERROR - Help: Expo SDK - Forums

My app signing/upload key and api key all match in terms of sha-1 etc. Can’t do anything there.

I completely removed my firebase project and setup new FCM/API’s yet still the same error. I’ll type it here (I’ll try to avoid mistakes but I have to type it, can’t copy/paste).

"userInfo":null, "message": "Fetching the token failed: FIS_AUTH_ERROR", "code": "E_REGISTRATION_FAILED", "line": 29, "column": 1111, "sourceURL:"/data/user/0/com.sapulidisappname.example/files/.expo-internal/<hash>"

:white_check_mark: SOLVED!!
So, I was testing (as mentioned a couple of times) on the internal test track in the google play store. I did not setup a store listing yet. I spoke to GCP support and Nash told me to finish the store listing and move to the closed track instead of the internal test. This fixed it for me!!

1 Like

I just checked the build logs and found this:

Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]

google-services.json is in root, just like app.json ("googleServicesFile": "./google-services.json",). Could this be an issue?

Edit: I just ejected the project and tried to make a build. The build fails but is not throwing the error Could not find google-services.json like in the Expo build logs. I do however see the google-services.json in the manifest. After some more digging on the forums/google I checked if the json is valid and someone also said the error/warning is always there so it’s no biggie?..

that error message is always present, it’s something we’re looking into.

@sapulidi have you tried dissecting the getExpoPushTokenAync method into pieces and finding out what specifically is going wrong? here’s the source- expo/getExpoPushTokenAsync.ts at master · expo/expo · GitHub

I finally managed to produce an error from getExpoPushTokenAsync()! I also installed Sentry but that’s not displaying it.

The error: Error: Fetching the token failed: FIS_AUTH_ERROR. I’ve done a quick search on the expo forums and I figured it could be that I’m doing something wrong regarding app signing or it’s a bug in Expo? Fetching the token Failed, message : FIS_AUTH_ERROR - Help: Expo SDK - Forums

My app signing/upload key and api key all match in terms of sha-1 etc. Can’t do anything there.

I’m not too sure what to do next. I’ll read up on this issue some more for now. Thanks!

I completely removed my firebase project and setup new FCM/API’s yet still the same error. I’ll type it here (I’ll try to avoid mistakes but I have to type it, can’t copy/paste).

"userInfo":null, "message": "Fetching the token failed: FIS_AUTH_ERROR", "code": "E_REGISTRATION_FAILED", "line": 29, "column": 1111, "sourceURL:"/data/user/0/com.sapulidisappname.example/files/.expo-internal/<hash>"

So, the error seems to originate from com.google.firebase:firebase-iid but this package has been deprecated. Anything there? I think I read every available thread on the error(s) but can’t figure out where my possible mismatch might be…

The APK uploaded to the google play store also doesn’t work but does work locally. What’s the main difference between local/dev (expo go/local apk) and the app being in the play store? Sha-1? google-services.json? I can’t figure it out.

It seems Firebase installations is responding with 403 errors. I restricted the firebase api key using the sha-1 hash from the play store (which match with the sha-1 in expo). Firebase Cloudmessaging and Firebase installations are enabled. I also added all the sha-1 I could find to the firebase configuration and redownloaded the google-services.json file (I have 14 of those now). New build still gives the FIS error.

I’m overlooking a tiny thing but it has been two weeks…

Another rubber ducky step-by-step:

  • Play store App integrity SHA hashes under upload key match Expo build credentials.
  • Firebase Cloud Messaging server key matches Expo Push notification credentials (FCM server Key).
  • GCP api key has Android apps as application restrictions. I enter my package name com.example.myapp, and use the SHA-1 that is under Expo build credentials (upload SHA-1).
  • In firebase, under general I add the SHA-1 in project settings->general->Your apps.
  • The downloaded google-services.json contains all that information. API key from GCP matches.
    "api_key": [ { "current_key": "GCP api key" } ],
  • in package.json "googleServicesFile": "./google-services.json", in the android object.
  • package name is correct.
  • In Google play internal test, whether it’s an APK/AAB the notifications give the FIS_AUTH_ERROR. Firebase installations hands out 403’s.

Please.

I removed the SHA-1 from firebase and the key is now fully unrestricted. Downloaded new google-services.json (which had a lot less in it, ofcourse) and made sure the current_key was correct. Still no luck.

Edit: I just reuploaded my keystore to expo to make sure nothing’s going wrong there. Still no luck after creating a new build (I’m 15 builds in trying to solve this issue…)

Also, my google places api key works just fine (that’s also fully unrestricted because SHA-1 doesn’t seem to work there). Is there like a checklist other than the FCM configuration docs (which I reread a hundred times by now) of all the things that should/shouldn’t match/be configured?

@sapulidi sorry you’ve gone so far on this goose chase. I think with 15 differnet google-services files, it’s starting to get pretty hairy, and you might want to instead try reproducing this same error on a blank project, from scratch.

Also- I think it would be useful to directly work on calling getDevicePushTokenAsync, and ensuring that’s where the problem lies (cut out the extra fluff of getExpoPushTokenAsync)

What’s the main difference between local/dev (expo go/local apk) and the app being in the play store?

The signing key is different, if you’re using Google play app-signing

I just spoke to a colleague and he mentioned that if I ever tapped a box asking if google should handle app signing for me, the sha-1 for you app is basically unknown (?). I do remember letting expo handle the signing in the beginning but I can’t remember if I tapped a wrong box in the google play store when I first released my app. Is there any way to see if it’s a signing issue? Eventhough the upload sha-1 displayed in google play console (app integrity) matches the one in expo?

Thanks a lot btw!

I can confirm that getDevicePushTokenAsync yields the same error. I might just start a completely new project but I’d lose all my internal test participants I’m afraid =(.

@charliecruzan I once again failed to @ reply to you properly I believe…

By the way, at this point I’m absolutely willing to pay someone for his/her time checking all my stuff…

For what it’s worth, this is what the error from getDevicePushTokenAsync produces:

{
  "nativeStackAndroid": [
    {
      "lineNumber": 5,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "e",
      "class": "com.google.firebase.iid.s"
    },
    {
      "lineNumber": 1,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "g",
      "class": "com.google.firebase.iid.s"
    },
    {
      "lineNumber": 2,
      "file": null,
      "methodName": "a",
      "class": "com.google.firebase.iid.r"
    },
    {
      "lineNumber": 3,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "run",
      "class": "d.f.b.e.k.o"
    },
    {
      "lineNumber": 0,
      "file": null,
      "methodName": "execute",
      "class": "com.google.firebase.iid.g"
    },
    {
      "lineNumber": 1,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "a",
      "class": "d.f.b.e.k.m"
    },
    {
      "lineNumber": 10,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "a",
      "class": "d.f.b.e.k.a0"
    },
    {
      "lineNumber": 6,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "t",
      "class": "d.f.b.e.k.d0"
    },
    {
      "lineNumber": 4,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "run",
      "class": "d.f.b.e.k.o"
    },
    {
      "lineNumber": 0,
      "file": null,
      "methodName": "execute",
      "class": "com.google.firebase.iid.g"
    },
    {
      "lineNumber": 1,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "a",
      "class": "d.f.b.e.k.m"
    },
    {
      "lineNumber": 10,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "a",
      "class": "d.f.b.e.k.a0"
    },
    {
      "lineNumber": 6,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "t",
      "class": "d.f.b.e.k.d0"
    },
    {
      "lineNumber": 1,
      "file": "com.google.android.gms:play-services-tasks@@17.1.0",
      "methodName": "c",
      "class": "d.f.b.e.k.j"
    },
    {
      "lineNumber": 3,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "c",
      "class": "com.google.firebase.iid.y$e"
    },
    {
      "lineNumber": 3,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "f",
      "class": "com.google.firebase.iid.y$g"
    },
    {
      "lineNumber": 3,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "e",
      "class": "com.google.firebase.iid.y$e"
    },
    {
      "lineNumber": 11,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "h",
      "class": "com.google.firebase.iid.y$b"
    },
    {
      "lineNumber": 2,
      "file": null,
      "methodName": "handleMessage",
      "class": "com.google.firebase.iid.z"
    },
    {
      "lineNumber": 102,
      "file": "Handler.java",
      "methodName": "dispatchMessage",
      "class": "android.os.Handler"
    },
    {
      "lineNumber": 1,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "a",
      "class": "d.f.b.e.g.g.e"
    },
    {
      "lineNumber": 2,
      "file": "com.google.firebase:firebase-iid@@20.2.3",
      "methodName": "dispatchMessage",
      "class": "d.f.b.e.g.g.e"
    },
    {
      "lineNumber": 223,
      "file": "Looper.java",
      "methodName": "loop",
      "class": "android.os.Looper"
    },
    {
      "lineNumber": 7660,
      "file": "ActivityThread.java",
      "methodName": "main",
      "class": "android.app.ActivityThread"
    },
    {
      "lineNumber": -2,
      "file": "Method.java",
      "methodName": "invoke",
      "class": "java.lang.reflect.Method"
    },
    {
      "lineNumber": 592,
      "file": "RuntimeInit.java",
      "methodName": "run",
      "class": "com.android.internal.os.RuntimeInit$MethodAndArgsCaller"
    },
    {
      "lineNumber": 947,
      "file": "ZygoteInit.java",
      "methodName": "main",
      "class": "com.android.internal.os.ZygoteInit"
    }
  ],
  "userInfo": null,
  "message": "Fetching the token failed: FIS_AUTH_ERROR",
  "code": "E_REGISTRATION_FAILED",
  "line": 25,
  "column": 1111,
  "sourceURL": "/data/user/0/com.package.packagename/files/.expo-internal/XXXXXXXHASHXXXXXXX"
}

Which I find weird because when I search for com.google.firebase.iid it says its been deprecated for quite some time now. Should Expo still be using this? → I need strikethrough text, I just read this [expo-notifications] Task :expo-notifications:compileDebugJavaWithJavac FAILED · Issue #12923 · expo/expo · GitHub

However, everytime I upload the AAB I’m being asked to provide missing native symbols. Could that have anything to do with it?

My API key in GCP is being called but a lot of 403 errors (explains the FIS_AUTH_ERROR I guess). When I check the metrics in GCP for the firebase installations api there are over 1000 requests for the createInstallation API method…

So the key is being called from my app (or somewhere) but it’s not going through.

Problem solved!! Updatet OP and title! YAY!

So, I was testing (as mentioned a couple of times) on the internal test track in the google play store. I did not setup a store listing yet. I spoke to GCP support and Nash told me to finish the store listing and move to the closed track instead of the internal test. This fixed it for me!!

1 Like

thanks for sharing the fix here @sapulidi ! Fully expect this thread to save someone a few days of work :grinning_face_with_smiling_eyes:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.