I'm working on Google chrome push notification with data payload and I am using the npm web-push. In my push api I called the function sendNotification() and passed the endpoint and the required parameters - public key, authkey and the data payload (string).
But when I tried to push the notification msg to GCM, I always get the below error from GCM.
Error occurred! { [WebPushError: Received unexpected response code]
name: 'WebPushError',
message: 'Received unexpected response code',
statusCode: 400,
headers:
{ 'content-type': 'text/html; charset=UTF-8',
date: 'Fri, 05 Aug 2016 17:26:59 GMT',
expires: 'Fri, 05 Aug 2016 17:26:59 GMT',
'cache-control': 'private, max-age=0',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '1; mode=block',
server: 'GSE',
'alternate-protocol': '443:quic',
'alt-svc': 'quic=":443"; ma=2592000; v="36,35,34,33,32,31,30"',
'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' }
Does anyone have any idea or suggestion?