This little script helps you generating an OAuth2 token that you can as auth-header for cURL requests or in REST clients such as Postman.
- Make sure you have node.js installed
- Have a FCM
service_accounts.json
File for Authentication (See FCM Docs
git clone <this repo>
cd fcm-oauth-generator
npm i
cp <path-to-your-serviceaccounts-file> .
npm start
or alternatively
node index.js
This results in an OAuth2 token output that can be used in postman.
If you don't want to install node.js on your host, try using Docker with a node.js image
- Create a POST Request
- Set the URL to https://fcm.googleapis.com/v1/projects/{{YOUR-FCM-PROJECT-ID}}/messages:send
- Set Authorization-Type to Bearer Token and set the scripts output as value.
- Define a valid Request Body (See FCM Docs)