javascript - Firebase Cloud Messaging Failing to Retrieve Instance ID - Stack Overflow

this is my first question on Stack Overflow!I am trying to deploy my firebase application on the fireba

this is my first question on Stack Overflow!

I am trying to deploy my firebase application on the firebase server using the ' firebase deploy' mand. While running the "messaging" example [provided by Firebase] on my local machine, I have no issues generating an instance ID. However, when I deploy the application on the Firebase server and run the app in the browser, the application is not able to retrieve the Instance ID from the FCM server. This is a snippet of the response that I am getting from the Chrome console:

No Instance ID token available. Request permission to generate one.
(index):226 Requesting permission...
(index):239 Unable to get permission to notify.  V
(index):226 Requesting permission...
(index):239 Unable to get permission to notify.  V {code: 

    "messaging/permission-blocked", 
    message: "Messaging: The required permissions were not grant… blocked instead. (messaging/permission-blocked)."}
code: "messaging/permission-blocked"message: "Messaging: The required permissions were not granted and blocked instead. (messaging/permission-blocked)."stack: (...) ....

this is my first question on Stack Overflow!

I am trying to deploy my firebase application on the firebase server using the ' firebase deploy' mand. While running the "messaging" example [provided by Firebase] on my local machine, I have no issues generating an instance ID. However, when I deploy the application on the Firebase server and run the app in the browser, the application is not able to retrieve the Instance ID from the FCM server. This is a snippet of the response that I am getting from the Chrome console:

No Instance ID token available. Request permission to generate one.
(index):226 Requesting permission...
(index):239 Unable to get permission to notify.  V
(index):226 Requesting permission...
(index):239 Unable to get permission to notify.  V {code: 

    "messaging/permission-blocked", 
    message: "Messaging: The required permissions were not grant… blocked instead. (messaging/permission-blocked)."}
code: "messaging/permission-blocked"message: "Messaging: The required permissions were not granted and blocked instead. (messaging/permission-blocked)."stack: (...) ....
Share Improve this question edited Oct 28, 2016 at 14:08 Frank van Puffelen 600k85 gold badges889 silver badges859 bronze badges asked Oct 28, 2016 at 6:00 Aman ZeeAman Zee 331 gold badge2 silver badges7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

It looks like you haven't request permission to receive notifications:

The method messaging.requestPermission() displays a consent dialog to let users grant your app permission to receive notifications in the browser. If permission is denied, FCM registration token requests result in an error.

messaging.requestPermission()
.then(function() {
  console.log('Notification permission granted.');
  // TODO(developer): Retrieve a Instance ID token for use with FCM.
  // ...
})
.catch(function(err) {
  console.log('Unable to get permission to notify. ', err);
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742331382a4423789.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信