Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct

I am having a lot of trouble researching this issue as there was a problem in the past on the expo side and all the posts are just related to that.

Android issue with push notifications, I uploaded the key from google-services.json (client, api_key, current_key), which is in a notifications folder.

I used the whole key, I have taken out the middle here:
expo push:android:upload --api-key AIza...MM4U

I can see the credential on the web portal under my project.

I get a token:
ExponentPushToken[lr4mfiMRIZUY1wqS9UoLr9]

But I always get the error:
{"data":{"id":"3b00e2b9-3e0e-4878-a7af-133c94448d8f","status":"error","message":"Failed to authenticate with the FCM server. Ensure the FCM server key you uploaded is correct.","details":{"error":"InvalidCredentials","fault":"developer","fcm":{"httpStatus":401,"response":"<HTML>\n<HEAD>\n<TITLE>INVALID_KEY_TYPE</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n<H1>INVALID_KEY_TYPE</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n"}}}}

com.thirstygolfer.dev is my app id, app.json:

    "android":{
      "package": "com.thirstygolfer.dev",
      "googleServicesFile": "notifications/google-services.json"
    },

iOS works fine for push, trying to figure out what I’m missing here.

Is the path to your googleServicesFile correct? I suspect it should look something like this (don’t know your project structure thought). "googleServicesFile": "./notifications/google-services.json"

It works, I found the solution last night, I was using the actual google API key, I needed to use the Firebase Server key token. Odd that it’s called api-key in the console command when that’s not what it is.

1 Like

Ah yeah, makes sense. Good job!

Glad you got to the bottom of things, @fizgigtiznalkie.

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