Send firebase cloud message from client without exposing API secret

前端 未结 2 1188
醉酒成梦
醉酒成梦 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

提交回复
热议问题