Chrome Web Push API, returning "Unauthorized Registration",

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' } 
+8
google-chrome push-notification google-cloud-messaging web-push
source share
3 answers

Do you use any HTTP server to verify the code in this tutorial? In addition, DNS must be localhost or https: // . If you use an HTTP server under some port, it is better to have a 5-digit client port. This is where my browser browser project is tied

+1
source share

There it is reported in the web push library : https://github.com/web-push-libs/web-push/issues/254 .

Can you try to reset the clock, as reporters did in this issue?

0
source share

Check the gcm_sender_id field in the manifest.json file if it exactly matches the gcm_sender_id in your google account. I used to run into a similar problem, and that was the solution to my problem.

0
source share

All Articles