I want to use the http package to send notifications to topics through the flutter app using the docs as in https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-topics
POST https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1
Content-Type: application/json
Authorization: Bearer ya29.ElqKBGN2Ri_Uz...HnS_uNreA
{
"message":{
"topic" : "foo-bar",
"notification" : {
"body" : "This is a Firebase Cloud Messaging Topic Message!",
"title" : "FCM Message"
}
}
}
Since it requires Access Token which expires every hour. How do I manage it in flutter?
httppackage required? Otherwise, you might have a look at the flutter packages. They do a lot of the heavy-lifting and handle stuff like refresh of the token: firebase.flutter.dev/docs/messaging/overview - Mark