FCM voor Tiqr
March 22, 2024 ยท View on GitHub
Prepare
- Log in to the Google cloud console
- Create or select a project. Copy the project ID and enter it in the config as
firebase_projectId
Add a new role
- Go to
IAM & Adminand selectrolesin the left menu - Create a new role, and name it
CloudMessagingin the title and id, set it to General Availibility. - Assign two permissions:
cloudmessaging.messages.createandfirebasecloudmessaging.messages.createand clickCreate
Add a new serviceaccount and key
- Go to
API's& Services, and click+ Enable API's and Services - Search for
firebase cloud messaging apiand enable it - Next, go to
Credentialsand create a new credential. Choose for the service account, enter a name, and ID, and copy the email-address generated - Open the new user and navigate to the
keystab. Add a new key, and chose the json format. The downloaded file should be places in the config directory and configured in the config file asfirebase_credentialsFile
Grant permissions
- Open a cloud shell (Icon in the top-right corner).
- Assign the role to the user by running :
gcloud projects add-iam-policy-binding <projectID> --member=serviceAccount:<serviceaccount-email> --role=projects/<projectID/roles/CloudMessaging