FCM authentication fails: InvalidCredentials: Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct..

Expo SDK version: 41.0.0

Expo is not able to authenticate with FCM. I have read every other post about this and no other solution has worked for me. FCM authentication also fails when using the online expo notification tool, with a supplied push notification token.

I have retrieved the correct server key from my firebase console and successfully uploaded to expo.

When I run “expo push:android:show”, I do get the correct FCM API key from beginning to end.

I have also tested the server key using curl against a firebase endpoint, and it authenticates successfully, so I do not believe there is an issue with the key itself.

What other reasons could there be for failed authentication?

EDIT: So, I just noticed in the expo console, on the credentials screen for the project, there are two tabs: Android (classic) and Android (EAS). I deleted the FCM server key from the classic tab and uploaded it to the EAS tab. Still getting the same error. What am I missing?

Solved:

  • If you are using EAS, be sure your Firebase server key is uploaded under the “Android (EAS)” tab on the credentials screen for your project.

  • If you are using EAS, always use the EAS commands versus the classic expo commands, and do not mix the two together as they behave differently.

Hey,
i’m running into the same issue. I followed your steps, removed the API key from the Android (classic) and added it to the Android (EAS) but i’m still getting the same error. so strange…

@haibert have you uploaded the key with expo push:android:upload?

Yes, at a point I had both uploaded, but I removed it, and only uploaded to the EAS, should I be doing both?

@haibert I deleted your reply because it contained your FCM API key. For anyone else finding this- it looks like uploading your key via the CLI fixes it. We’re aware of this issue in the website GUI and are working on a fix now

Ty Charlie!
I had actually scrambled random letters into the Server Key and just left it for a very clear example but ty for looking out. Also I think the following steps should be included in the documentation for implementing push notifications in custom clients situations.

  1. Run eas credentials choose Android, then choose Push Notifications: Manage your FCM Api Key, then paste your API key here.
  2. Go to expo.dev and in your projects credential tab go to Android (EAS) and also paste it there.
  3. Set up your iOS push notification credentials by running run expo credentials:manager -p ios , then select Use existing Push Notifications Key in current project or use a new one…
    4.Make sure to include the experience id in your getExpoPushTokenAsync call. The experience id is @username/appSlug.
  4. use experienceId in your get token call even though its not a bare project.
    token = await Notifications.getExpoPushTokenAsync({
    experienceId: '@username/projectSlug,
    })
  1. This is optional, you can just use expo push:android:upload instead- Using FCM for Push Notifications - Expo Documentation
  2. Again, this is optional, just another way of doing it
  3. Not part of the FCM setup, this is for APNs, and is documented: Using automatically managed credentials - Expo Documentation
  4. We’re working on this now to make this experience better, so that you don’t need to pass the experience ID at all, but I’ll update the docs

Any updates? am still having this issue, even though I followed all the steps.

We’re still in the process of fixing the GUI on expo.io, so use expo push:android:upload