I am doing a google tutorial on how to send web push notifications in Chrome using the web push node module.
This tutorial also contains a companion server application that you should use to verify that push notifications are sent from the server to the client.
But, both in the companion application, and when using web-push cli on my local machine, when I try to send a notification, I get the error message < Unauthorized registration . Can't find anything on the Internet about this error - what am I doing wrong / missing?
$ 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' }
google-chrome push-notification google-cloud-messaging web-push
maephisto
source share