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 ?"
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 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).
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.
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.
Based on https://firebase.google.com/docs/cloud-messaging/js/client
Vapid Key is "Voluntary Application Server Identification". We can find it in:
Or look at steps by steps images below
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With