How to Resolve 'Platform credentials are invalid' Error in Amazon SNS with a Previously Working GCM API Key

How to Resolve ‘Platform credentials are invalid’ Error in Amazon SNS with a Previously Working GCM API Key
Having trouble with an Amazon Simple Notification Service (SNS) error? If you’re a data scientist or software engineer, you might have come across the ‘Platform credentials are invalid’ error when re-entering a previously working GCM API Key. It’s a common issue, but it can be perplexing, especially when the same key worked perfectly before.
Let’s get to the bottom of this issue in this post. We’ll demystify the error, explore why it happens, and offer a step-by-step guide to resolving it.
What is Amazon SNS?
First, let’s quickly recap what Amazon SNS is. Amazon Simple Notification Service (SNS) is a fully managed, robust messaging service that allows you to send messages or notifications directly to users with a simple setup. It’s highly scalable, reliable, and flexible, making it ideal for a wide variety of use cases.
What Causes the ‘Platform credentials are invalid’ Error?
The error message ‘Platform credentials are invalid’ typically appears when you’re setting up or reconfiguring your Amazon SNS, and you need to provide a GCM API key. The key was previously working, but now it’s not. So, what’s the problem?
The error could be due to a few reasons:
API Key Invalidated: Google may have invalidated your GCM API key. It could be due to a policy violation or security reasons.
Switch to FCM: Google Cloud Messaging (GCM) has been deprecated and replaced by Firebase Cloud Messaging (FCM). If you haven’t switched yet, that could be the source of the problem.
How to Resolve the Error
Now that we know the potential reasons, let’s dive into the solution.
Step 1: Check the API Key
Before proceeding, first verify if your GCM API key is still valid. You can do this by logging into your Google Developers Console and navigating to the respective project. If the key has been invalidated, you will need to create a new one.
Step 2: Migrate to FCM
Google has officially deprecated GCM and recommends migrating to FCM. If you haven’t done this yet, it’s time to make the switch. Here’s how:
Login to Firebase Console: Navigate to the Firebase console, and sign in with your Google account.
Add Project: Click on ‘Add project’ and select the project for which you had the GCM API key.
Navigate to Project Settings: Once the project is open, go to ‘Project settings’ by clicking on the gear icon.
Cloud Messaging Tab: Click on the ‘Cloud Messaging’ tab. Here, you will find your new server key under ‘Project Credentials’. This is your FCM key.
Step 3: Update the Key in Amazon SNS
Now, it’s time to update the key in Amazon SNS.
Login to Amazon SNS: Navigate to the Amazon SNS console and log in.
Navigate to Mobile: Click on ‘Mobile’, and then ‘Push notifications’.
Update the Key: Find the application where you need to update the key. Under ‘Actions’, click on ‘Edit’, and replace the GCM API key with your newly obtained FCM key.
Save Changes: Click on ‘Save changes’. Now, your Amazon SNS should be working with the new key.
And that’s it! You’ve successfully resolved the ‘Platform credentials are invalid’ error.
Conclusion
While it can be frustrating to encounter an error like ‘Platform credentials are invalid’ when working with Amazon SNS and a previously functional GCM API key, the solution is straightforward. Most likely, you need to migrate from GCM to FCM and update your key in Amazon SNS. Follow the steps above, and you’ll be back on track in no time.
Remember, as data scientists or software engineers, problem-solving is part of our job description. Every error is just another puzzle waiting to be solved. Happy troubleshooting!
About Saturn Cloud
Saturn Cloud is your all-in-one solution for data science & ML development, deployment, and data pipelines in the cloud. Spin up a notebook with 4TB of RAM, add a GPU, connect to a distributed cluster of workers, and more. Join today and get 150 hours of free compute per month.