Web Push API Chrome,返回"未经授权的注册"

mae*_*sto 12 google-chrome push-notification google-cloud-messaging web-push

我一直在做一个关于如何使用web-push节点模块在Chrome上发送网络推送通知的谷歌教程.

问题是,本教程还提供了一个配套服务器应用程序,您应该使用它来测试从服务器向客户端发送推送通知.

但是,在配套应用程序中,甚至在我的本地计算机上使用web-push cli时,在尝试发送通知时,我收到" 未经授权的注册 "错误.在网上找不到任何关于这个错误的信息 - 我做错了什么/缺少什么?

$ web-push send-notification --endpoint=https://fcm.googleapis.com/fcm/send/<<endpoint-key>>
Error sending push message:
{ [WebPushError: Received unexpected response code]
  name: 'WebPushError',
  message: 'Received unexpected response code',
  statusCode: 400,
  headers:
   { 'content-type': 'text/html; charset=UTF-8',
     date: 'Fri, 25 Nov 2016 08:54:08 GMT',
     expires: 'Fri, 25 Nov 2016 08:54:08 GMT',
     'cache-control': 'private, max-age=0',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'SAMEORIGIN',
     'x-xss-protection': '1; mode=block',
     server: 'GSE',
     'alt-svc': 'quic=":443"; ma=2592000; v="36,35,34"',
     'accept-ranges': 'none',
     vary: 'Accept-Encoding',
     connection: 'close' },
  body: '<HTML>\n<HEAD>\n<TITLE>UnauthorizedRegistration</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>UnauthorizedRegistration</H1>\n<H2>Error 400</H2>\n</BODY>\n</HTML>\n' }
Run Code Online (Sandbox Code Playgroud)

Mar*_*rco 0

web-push 库问题跟踪器中有一份关于此问题的报告: https: //github.com/web-push-libs/web-push/issues/254

你能像那期记者那样尝试重置你的时钟吗?