Server setup to send the notifications

The first step is to enable FCM API for your project. You can go to https://console.developers.google.com/apis/api/fcm.googleapis.com/overview?project=<project-id> and enable it.

To send the notification from a trusted environment, we will need an Oauth2 access token and the client registration token that we get in the client app.

To get the Oauth2 access token, we will need the private keys from your service account. Once you generate the private key, save the JSON file containing your private key at some secure place. We will use Google API Client Library at https://developers.google.com/api-client-library/ to retrieve the access token, so install the npm module for googleapis using the following command: ...

Get Serverless Web Applications with React and Firebase now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.