【问题标题】:Firebase Cloud Messaging where to find PUBLIC VAPID KEYFirebase 云消息传递在哪里可以找到 PUBLIC VAPID KEY
【发布时间】:2019-07-26 12:44:18
【问题描述】:

我正在通过 Firebase 为 Web 应用实施推送通知,并遵循 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]

我的问题是“什么是 Vapid 密钥?我在哪里可以找到这个密钥?”

【问题讨论】:

    标签: firebase firebase-cloud-messaging


    【解决方案1】:

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

    Vapid Key 是“自愿应用服务器标识”。我们可以在以下位置找到它:

    1. 打开 Firebase 控制台 设置 窗格的 Cloud Messaging 标签并滚动到 Web 配置 部分。
    2. Web 推送证书 选项卡中,单击生成密钥对。控制台显示密钥对已生成的通知,并显示公钥字符串和添加日期。

    或者看下面的步骤图片

    1. 打开项目设置

    1. 选择云消息传递,向下滚动到Web配置。在Web Push Certificate中可以找到Vapid key(如果不存在,点击Generate Key Pair创建)

    【讨论】:

    • 谢谢,我用它来flutter_messaging,好的。
    猜你喜欢
    • 2016-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-12
    • 1970-01-01
    相关资源
    最近更新 更多