Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Messaging where to find PUBLIC VAPID KEY

Tags:

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

On index.html I see this code

    // [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 ?"

like image 372
Bùi Đức Khánh Avatar asked Mar 05 '19 05:03

Bùi Đức Khánh


People also ask

How do I get Firebase vapid key?

Generate a new key pairOpen the Cloud Messaging tab of the Firebase console Settings pane and scroll to the Web configuration section. In the Web Push certificates tab, click Generate Key Pair.

What is a vapid key?

What is VAPID? VAPID, which stands for Voluntary Application Server Identity, is a new way to send and receive website push notifications. Your VAPID keys allow you to send web push campaigns without having to send them through a service like Firebase Cloud Messaging (or FCM).

Where is Firebase Cloud Messaging server key?

Click the Cloud Messaging tab next to the General tab. The Project credentials section appears. The Project credentials section displays the Firebase Cloud Messaging token, Sender ID, and the Server key.

How do I make a vapid key?

You'll need to create and provide a public and private key for your server. These keys must be safely stored and should not change. Click 'GENERATE' button to generate VAPID keys and use them to authenticate you. Based on the web-push-libs/web-push-php library.


1 Answers

Based on https://firebase.google.com/docs/cloud-messaging/js/client

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

  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.

Or look at steps by steps images below

  1. Open Project settings

enter image description here

  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 )

enter image description here

enter image description here

like image 149
Bùi Đức Khánh Avatar answered Sep 20 '22 02:09

Bùi Đức Khánh