16

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
David
  • 188
  • 1
  • 1
  • 5

4 Answers4

22

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.

Marco Silva
  • 221
  • 2
  • 2
17

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

Community
  • 1
  • 1
Diego Giorgini
  • 12,489
  • 1
  • 47
  • 50
  • Thanks, we didn't solve the issue as to why the key would no longer work for a new SNS application, however the issue was urgent so we created a new one (in Firebase) and had to update our app accordingly. Annoying, but it solved our particular issues. – David Sep 12 '16 at 08:41
2

I have been getting the same error when creating Amazon SNS platform application:

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

After reaching out to the Firebase support as suggested by Diego, this is the response I got from Google:

Hope you're doing well and thanks for reaching out to us.

I'm not really familiar with Amazon SNS and looks like their integration is still with GCM, not FCM. If your app implementation is still GCM, then you need to migrate with FCM in order to use the server key in the console. See the instructions here.

Also, Firebase has upgraded the server keys to a new version. We'd recommend to use the server key instead of the legacy server key.

I hope this helps. Let me know if you have any other concerns. Thank you.

This indicates that we'll have to change our app code. We were able to make this work for another app in out organization by creating a new firebase project and using the Legacy server key with Amazon SNS.

At some point we'll definitely upgrade to using FCM but at the moment we have a tight deadline.

Update: So finally what worked for us is using the 'Server Key' under Project Settings --> Cloud Messaging . The app still uses the GCM implementation. Amazon SNS is happy with this key and generated a GCM platform push application. The pushes work ! Still confused about why the 'Legacy Server Key' does not work for one app but is ok for the other. But I am not digging into it any further.

user1984795
  • 167
  • 1
  • 9
1

For those starting a new project and wondering why it is still invalid, make sure the application Key restriction is set to Android apps. In my case, it was at only set to None and when I switched to Android apps, it worked after 5 to 10min after updating it. You'll need to add your package name and SHA-1 certificate fingerprint.

Sam Bellerose
  • 1,782
  • 2
  • 18
  • 43