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

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

问题描述

有什么方法可以在 Firebase 控制台中为 FCM(云消息部分)重新生成 API 密钥?该密钥不可编辑,并且与 Google API 控制台中自动生成的密钥不同.由于这种错误配置,我总是从 FCM 收到 unauthorized 401...

解决方案

更新:即使在 FCM Token 可见的 Cloud Messaging Tab 的新 UI 中,Regenerate Key<如果服务器密钥被删除,/kbd> 按钮仍然可见.


更新:现在似乎可以通过 Firebase 控制台重新生成服务器密钥,但是,标签/按钮(见屏幕截图)仅在没有使用服务器密钥时显示.

点击Regenerate Key后,会生成一个新的Server Key,在Google Developers Console中也可以看到.


仍然无法从 Firebase 控制台重新生成 API 密钥.但是,我能够通过开发者控制台重新生成它.

在与@SarthakMishra 讨论后,我再次浏览了控制台,并且能够真正重新生成在 Firebase 控制台中找到的 API 密钥.

首先,我将提供有关获取实际查看当前服务器密钥的部分的步骤.

  1. 通过右上角选择您的项目.
  2. 然后在左侧面板上,点击齿轮按钮并选择项目设置.
  3. 然后转到云消息标签

从那里,您将能够看到服务器密钥和发件人 ID.


以下是重新生成服务器密钥的步骤.转到您的开发者控制台.

  1. 在右上角,选择与您的 Firebase 项目对应的项目名称.
  2. 在左侧面板上,点击 Credentials .

之后,您将能够看到当前可用于该项目的 API 密钥.通常,您会看到两个 API 密钥.一个 Server Key 和一个 Android Key,旁边有一个标签,上面写着(由 Google 服务自动创建).单击服务器密钥.

  1. 点击重新生成密钥.应该会出现这样的提示:

<块引用>

您想用新的密钥替换当前密钥吗?

新密钥将立即可用.当前密钥将在 24 小时后永久停用.

  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天全站免登陆