Can't fetch Expo Token notification in standalone app

Hi,
I can’t fetch expo token notification in android standalone app (signin with Google).
I use SDK 42 version.
My issue is very similar to : Fetching the token Failed, message : FIS_AUTH_ERROR
When I log error with sentry I get : " Error: Fetching the token failed: FIS_AUTH_ERROR".

It’s working fine within managed expo workflow.

I configured my project :

  • Created an android project in firebase console with the same package name than in my “app.json”.

  • Downloaded the google-services.json file from firebase

  • Changed the api key inside the json file just downloaded in order to be the same that the one created in my google cloud console. The restrictions for this key : (restricted for android app , the package name is the one from app.json and SHA1 is the one from Google Play Console because app signed by Google and finally there is no restriction concerning google api.)

  • Placed the google-services.json file in my root folder of my project app directory and linked it inside my app.json in android.googleServiceFile : “googleServicesFile”: “./google-services.json”.

  • I uploaded my credentials with command : "expo push:android:upload --api-key " and the key from firebase => cloud messaging => key server.

The SHA1 certificate in my firebase setting for Android and inside the key settings in Google Cloud console is from Google Play Console => Application integrity => Sha1.

I really don’t understand why it’s not working properly, if you have any insights, please feel free to do so.

Hi! We’ve got a couple threads on this, and pretty much every time it’s due to the API key having too many restrictions on it, so I would remove any restriction whatsoever and then retest.

You may want to take a look at these links:

Sorry for the late answer and thank you for your time.
Unfortunately I can’t figure what is going wrong.
I tried to use a key with no restriction at all in my google-services.json file but still the same issue.

I followed step by step the guideline that is here : Using FCM for Push Notifications - Expo Documentation

One post was suggesting that the issue could occur in internal test in google play store so I also tried in closed test but same thing.

If anyone has an insight …
thanks

Finally it works !
I completely deleted android application in my firebase console, then added it again the android app to firebase which created new credentials in Google Cloud Platform.
I didn’t change credentials in google-services.json and used the ones just created.
I used the SHA1 from Google Play so you need to upload at least a build to know it.

I finally build another APK for Store, and release a version in open testing.
It worked.

I think it was not API key but the Auth Client Id which was wrong.
So you should check that Client Id and API key are the good ones in google-services.json. Also make sure you use SHA1 from the Google Play Store in your Google firebase project.

I also deleted googleSignIn config in my app.json which was not needed because googleServiceFile override it.

1 Like

Every time the app is installed, the device may get a new push token , which can lead to incorrect tokens saved in databases.