Jump to content
MikeMon

FCM App Server is returning with a "401: INVALID_KEY" Response

Recommended Posts

Hi

 

I've setup firebase cloud messaging and everything is working fine both on iOS and Android, i.e. I can send push notifications through the Firebase Cloud Messaging console. What I want to do is to develop my own console with which I want to send my firebase push notifications.

 

I came across the following in the FCM app server protocols:

 

https://fcm.googleapis.com/fcm/send

 

To test it, I'm using the "Embarcadero REST Debugger" software. As per the FCM documentation, I've add a header called "Authorization" with a value of "key=XYZ". XYZ is the "Server Key" value in the Firebase Console's "Cloud Messaging" setting of my App. Unfortunately I keep on getting a "401: INVALID_KEY" response. Is there anything else I need to do to make it work?

Share this post


Link to post
10 hours ago, Dave Nottage said:

Does it need to be a "server"? I have this desktop app: https://github.com/DelphiWorlds/PushIt

Hi Dave. Thank you for your valuable input. I compiled and ran your desktop app and it's working perfectly. I will check your code and see what I'm missing.

Share this post


Link to post
3 hours ago, MikeMon said:

Hi Dave. Thank you for your valuable input. I compiled and ran your desktop app and it's working perfectly. I will check your code and see what I'm missing.

Hi @Dave Nottage

 

After some playing around, I found out what the problem was. The "Authorization" header should not be encoded. Now, everything works fine by using REST. 

 

FYI, the pre-complied RESTDebugger.exe that comes with Delphi 10.3.3 doesn't have the "Do Not Encode" checkbox when adding parameters. I had to recompile its project and it was there.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×