我一直在做google tutorial關於如何使用網頁推送節點模塊在Chrome上發送網頁推送通知。網頁推送API Chrome,返回「未經授權的註冊」
問題是,本教程還提供了一個companion server app,您應該使用它來測試從服務器向客戶端發送推送通知。
但是,在伴侶應用程序中,甚至在本地機器上使用網絡推送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' }
你能解決這個問題嗎? – michaeltintiuc
試試這個圖書館:https://github.com/emretekince/fcm-web-push –
真相對我來說似乎是:http://stackoverflow.com/a/42023959/813000 –