Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon SNS: "Platform credentials are invalid" when re-entering a GCM API key that previously worked

We have been using Amazon SNS to send Android push notifications since April this year.

Pushes have sent with no problem, however there has never been any record of calls to the Cloud Messaging API in the Cloud Console (seems odd?).

Today I created a new API key for the Static Map service (unrelated) and renamed our Cloud Messaging API key (only the name, the key is the same). From this point no pushes have been sent, and trying to create a new platform application (or update the existing one) in AWS results in:

Invalid parameter: Attributes Reason: Platform credentials are invalid (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID:)

I have also tried manually making calls to the https://gcm-http.googleapis.com/gcm/send endpoint using the key which results in Unauthorized (401).

Interestingly, I can make calls to the above endpoint using the key I created today, however they fail on MismatchSenderId.

I can't see a lot of the previous options that the Cloud Console had (server / browser keys, etc) within the API Manager?

like image 787
David Avatar asked Sep 09 '16 18:09

David


2 Answers

For those who are facing this in 2017, here goes a tip:

1 - Go to your firebase console (https://console.firebase.google.com/) click on your project (which you want to use for push notifications)

2 - Click on the "three dots" on the right side of your project name and click on "Settings"

3 - Click on "CLOUD MESSAGING" on the header tabs

4 - Copy the "Server Key" (this one is bigger than your API key)

5 - Paste on the "API Key" input of the AWS Form for "Create platform application"

PS: Note that this is valid only for GCM Push Notifications.

like image 93
Marco Silva Avatar answered Nov 12 '22 17:11

Marco Silva


API Key management for GCM has been moved to Firebase Console. You can create a new Firebase Project (or import an existing cloud project) and you should obtain a new Server Key for Cloud Messaging.

see the updated documentation:
https://developers.google.com/cloud-messaging/android/client#create-an-api-project
and the stack overflow question: Where can I find the API KEY for Firebase Cloud Messaging?

if you still have problems please contact:
https://firebase.google.com/support/contact/troubleshooting

like image 16
Diego Giorgini Avatar answered Nov 12 '22 18:11

Diego Giorgini