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?