1

I was going through the Code Lab for web push notifications, which mentions that application server keys (public and private key pair) are required.

Why do we need application server keys for push notifications? How can we generate them? Is it mandatory to have application keys in order to work with push notifications?

See companion site to generate application server keys

tony19
  • 125,647
  • 18
  • 229
  • 307
Jagajit Prusty
  • 2,070
  • 2
  • 21
  • 39

1 Answers1

5

The documentation that you linked explicitly says how to generate the key, in the Get Application Server Keys paragraph.

Another way is to use the web-push library (either by calling the generateVAPIDKeys function via some Node.js code or via its command line interface).

Regarding the why and how is it related to Web Push, I think the abstract of the VAPID specification is quite clear:

An application server can voluntarily identify itself to a push service using the described technique. This identification information can be used by the push service to attribute requests that are made by the same application server to a single entity. This can used to reduce the secrecy for push subscription URLs by being able to restrict subscriptions to a specific application server. An application server is further able include additional information the operator of a push service can use to contact the operator of the application server.

Community
  • 1
  • 1
Marco Castelluccio
  • 10,152
  • 2
  • 33
  • 48