Firebase云消息传递API密钥 [英] Firebase Cloud Messaging API Key

查看:424
本文介绍了Firebase云消息传递API密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何方式重新生成Firebase控制台中的FCM(云消息传递部分)的API密钥?该键不可编辑,与Google API控制台中自动生成的键不同。由于这种错误配置,我总是从FCM获得未经授权的401 ...

>更新:即使FCMS令牌可见的云消息传递选项卡的新UI,如果服务器密钥被删除,重新生成密钥按钮仍然可见。








更新:现在似乎可以通过Firebase控制台重新生成服务器密钥,但只有在没有使用服务器密钥时才会显示标签/按钮(请参见截图)。




  1. 在右上角,选择与您的Firebase项目相对应的项目名称。

  2. 在左侧面板上,单击 Credentials

之后,您将能够看到当前可用于项目的API密钥。通常您会看到两个API密钥。一个服务器密钥和一个Android密钥,其旁边有一个标签(由Google服务 自动创建 )。点击服务器密钥。


  1. 点击重新生成密钥。这样的提示应该显示出来:




是否要用新的?$ / b>

新密钥将立即可用。




  1. 点击替换密钥

之后,您将看到新的服务器密钥生成。返回到可以看到服务器密钥和发件人ID的页面并刷新它。它应该匹配生成的新的服务器密钥。


Any way to regenerate the API Key for FCM (Cloud Messaging section) in Firebase Console? The key is not editable and is different from the one automatically generated in Google APIs Console. Due to this misconfiguration I'm always getting unauthorized 401 from FCM...

解决方案

Update: Even with the new UI of the Cloud Messaging Tab where the FCM Token is visible, the Regenerate Key button would still be visible if the Server Key was deleted.


Update: It seems it is now possible to regenerate the Server Key via the Firebase Console, however, the label/button (see screenshot) only shows up when there is no Server Key being used.

After clicking on Regenerate Key, it will generate a new Server Key which is also visible in the Google Developers Console.


Still no way to re-generate the API Key from Firebase Console. HOWEVER, I was able to re-generate it via the Developer Console.

I went through the consoles again after having a discussion with @SarthakMishra and was able to actually re-generate the API Key found in the Firebase Console.

First, I'll provide the steps on getting to the part where to actually see the current Server Key.

  1. Select your project via the top-rightmost side.
  2. Then on left-side panel, click on the gear button and select Project Settings.
  3. Then go to the Cloud-Messaging Tab

From there, you will be able to see the Server Key and the Sender ID.


Here are the steps to re-generate the Server Key. Go to your Developer Console.

  1. On the top-rightmost side, select the project name that corresponds to your Firebase Project.
  2. On the left-side panel, click on Credentials .

After that, you will be able to see the API Keys currently available for the project. Commonly, you will see two API Keys. One Server Key and one Android Key, where it has a label beside it saying (auto created by Google Service). Click on the Server Key.

  1. Click on Regenerate Key . A prompt like this should show up:

Do you want to replace the current key with a new one?

The new key will be available immediately. The current key will be deactivated permanently in 24 hours.

  1. Click on Replace key .

After that, you will see the new Server Key generated. Go back to the page where you can see the Server Key and Sender ID and refresh it. It should match the new Server Key generated.

这篇关于Firebase云消息传递API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆