Friday, 14 April 2017

google cloud messaging push error

I am trying to build a service worker push demo. Here is my demo page: https://www.zhuyingda.com/push Click the button, and click the sw push in chrome devtools application.

I install the web-push package with global mode, and try this command and params:

web-push send-notification --endpoint=https://fcm.googleapis.com/fcm/send/c6c_iaSWVs8:APA91bF1Hmc6IOOti8uPoHFeuPfJv4K_UL6gSXLYfml_w2TzC7fHX271Yt6DNnC0f_EAUzs5Vy-0ZdZX6q46fXWl7J83andAumJLAT57tQWgChMf9lJSsdwDckVEpo5nPDxu-aGjed85 --key=BJKnNrohqVGZVeamR7dS9aQigz20pr-AoBkpgyQ2DUyPsGu4kwJeBsUQO7PvKPjJSogBBs5C2i1L2FEE-YhxBlg= --auth=kWnlzAGa22OaHFBqZRlSJw== --payload=helloworld --gcm-api-key=AAAA9di5kYw:APA91bHpMmKH2voljZkjcyRp08ijHnpslnmsdDQ4u8D93QlHQDbXLfYbIe4DzTluY3LYxUHcSmXQ2hIMFzaR5f6sucBhGf70sN1xwgp-AHIMTMnIqpqjONadfcVpyHegQX1igLi_q-MQ

but I got this Error:

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, 14 Apr 2017 08:53:32 GMT', expires: 'Fri, 14 Apr 2017 08:53:32 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="37,36,35"', 'accept-ranges': 'none', vary: 'Accept-Encoding', connection: 'close' }, body: '\n\nUnauthorizedRegistration\n\n\n

UnauthorizedRegistration

\n

Error 400

\n\n\n', endpoint: 'https://fcm.googleapis.com/fcm/send/c6c_iaSWVs8:APA91bF1Hmc6IOOti8uPoHFeuPfJv4K_UL6gSXLYfml_w2TzC7fHX271Yt6DNnC0f_EAUzs5Vy-0ZdZX6q46fXWl7J83andAumJLAT57tQWgChMf9lJSsdwDckVEpo5nPDxu-aGjed85' }

via zhuyingda

No comments:

Post a Comment