Firebase Cloud Messaging在哪里可以找到PUBLIC VAPID KEY [英] Firebase Cloud Messaging where to find PUBLIC VAPID KEY

查看:245
本文介绍了Firebase Cloud Messaging在哪里可以找到PUBLIC VAPID KEY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Firebase实施Web App的推送通知,并遵循Google的此指南

I'm implementing Push Notification for Web App via Firebase and follow this guidelines from Google

https://github.com/firebase/quickstart-js/tree /master/messaging

index.html上,我看到此代码

    // [START get_messaging_object]
    // Retrieve Firebase Messaging object.
    const messaging = firebase.messaging();
    // [END get_messaging_object]

    // [START set_public_vapid_key]
    // Add the public key generated from the console here.
    messaging.usePublicVapidKey('<YOUR_PUBLIC_VAPID_KEY_HERE>');
    // [END set_public_vapid_key]

我的问题是什么是虚拟密钥?在哪里可以找到该密钥?"

My question is "What is Vapid Key ? and Where I can find this key ?"

推荐答案

基于 https://firebase.google.com/docs/cloud-messaging/js/client

Vapid密钥是自愿的应用程序服务器标识".我们可以在以下位置找到它:

Vapid Key is "Voluntary Application Server Identification". We can find it in:

  1. 打开Firebase控制台云消息标签>设置窗格,然后滚动到网络配置部分.
  2. Web Push证书标签中,点击生成密钥对.控制台会显示已生成密钥对的通知,并显示公共密钥字符串和添加日期.
  1. Open the Cloud Messaging tab of the Firebase console Settings pane and scroll to the Web configuration section.
  2. In the Web Push certificates tab, click Generate Key Pair. The console displays a notice that the key pair was generated, and displays the public key string and date added.

或查看下面的分步图片

  1. 打开项目设置

  1. 选择 Cloud Messaging ,向下滚动到 Web配置.在 Web Push证书中,您可以找到Vapid密钥(如果不存在,请单击 Generate Key Pair 进行创建)
  1. Choose Cloud Messaging, scroll down to Web configuration. In Web Push certificates you can find Vapid key ( If it doesn't exists, click Generate Key Pair to create )

这篇关于Firebase Cloud Messaging在哪里可以找到PUBLIC VAPID KEY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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