Update: There is now a visible note in the GCM docs saying:
Starting from Sept. 2016 new server key can only be created in the Firebase Console using the Cloud Messaging tab of the Settings panel. Existing projects that need to create a new server key can be imported in the Firebase console without affecting their existing configuration.
Update: It seems that using the Server Keys from the Firebase Console is the sure thing solution.
If you are just starting to use GCM, instead of creating a project in the Google Developers Console, do it in the Firebase Console. After creating the project, simply use the auto-generated Server Key. Here are the steps where to find the Server Key:
- Go to your Firebase Console and click on CREATE NEW PROJECT.
- Fill in your desired Project Name and select your Country. After this, the new Project should be active.
- Then on left-side panel, click on the gear button and select Project Settings.
- Then go to the Cloud-Messaging Tab.
For old GCM projects, you can simply Import the project to the Firebase Console:
- Go to your Firebase Console and click on IMPORT PROJECT.
- Select the project you want to import and your country.
- Click on ADD FIREBASE. After this, the new Project should be active.
- Then on left-side panel, click on the gear button and select Project Settings.
- Then go to the Cloud-Messaging Tab.
Basing from the image, you've already generated an API Key. But gonna include the steps for visibility:
- Go to your Google Developers Console
- On the left-pane, click on Credentials
- Under the Credentials Tab, Click on Create Credentials
- Select API Key
With that, the API Key is already available. However, it will default as a No Restriction key. You may click on Restrict Key to add the restriction corresponding to what you need the API Key for.
I'm not entirely sure, but for a Browser Key, I think you would need to set the HTTP referrers (web sites) restriction. Since basing from the other restrictions:
- IP addresses (web servers, cron jobs, etc.) = Server Key
- Android apps = Android Key
- iOS apps = iOS Key
You may try the API Key generated without any restrictions, however, it is highly encouraged for you to add the corresponding restriction as a security measure against unauthorized usage and quota theft.