Send firebase cloud message from client without exposing API secret

前端 未结 2 1156
醉酒成梦
醉酒成梦 2021-01-14 15:02

I\'m developing a new chat application that currently works with firebase realtime database and cordova.

I was looking for a backend-less solution since my currently

相关标签:
2条回答
  • 2021-01-14 15:48

    Cloud Functions for Firebase was launched today, which would solve your problem! You can initialize the firebase-admin SDK within your functions code (which runs on Google's servers, not client side), and use it to access FCM. That way you can send messages in response to new database items, or in response to HTTPS requests.

    Here's an intro to Cloud Functions for Firebase: https://firebase.google.com/docs/functions/

    Here's how you can use firebase-admin to send FCM messages: https://firebase.google.com/docs/cloud-messaging/admin/send-messages

    0 讨论(0)
  • 2021-01-14 15:59

    Sending downstream messages to devices with Firebase Cloud Messaging requires access to the authorization key. For that reason it should run in a trusted process, such as on hardware you control.

    0 讨论(0)
提交回复
热议问题