1

To receive a device token for Firebase Cloud Messaging (FCM) you need to first get permission from the user, which makes total sense because most web push notifications are handled in the background, and trigger desktop notifications.

getMessagingToken() {
    messaging.requestPermission()
    .then(function() {
        return messaging.getToken()
    })
})

However, I would like to use the Push API for in-app messaging and payload transfer. This requires a token, but also user permission. Is there a way to get a token for FCM to work for in-app push notifications only without requesting user permission? Is there an alternative to managing user-to-user data payload transfer?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
user1710344
  • 91
  • 1
  • 1
  • 9
  • 1
    https://stackoverflow.com/questions/53403792/can-i-use-firebase-cloud-messaging-without-notification-permission-javascript seems there is no way :( an alternative would be to implement web sockets on your own, or use a service like Pusher maybe. – steezeburger Dec 16 '20 at 21:32

0 Answers0