ram
ram

Reputation: 21

Chrome push notifications Device endpoint error getting 401 unauthorization error

I have a site which is trying to implement the push notifications. I have registered a project with google dev console and have the manifest.json . But from my index.html the manifest.json is giving the following errors

1)Failed to load resource: the server responded with a status of 401 (Unauthorized) 2) Manifest parsing error: Line: 1, column: 1, Unexpected token. 3) Unable to subscribe to push. DOMException: Registration failed - no sender id provided

Do i need to do anything from the google project registration side?? or should i do anything from my server side? The site is running in .Net Server and i have mime type .json

Upvotes: 2

Views: 1806

Answers (2)

simon
simon

Reputation: 16280

The combination of

1) Failed to load resource: the server responded with a status of 401 (Unauthorized)"

and

2) Manifest parsing error: Line: 1, column: 1, Unexpected token.

indicates that something (HTTPAuth?) is blocking the browser's request for the manifest.json file, and it's attempting to parse whatever the server is returning as a 401 response (which won't be JSON...). If the browser can't download the manifest.json file, you can't expect anything to work after that.

Upvotes: 2

Matt Gaunt
Matt Gaunt

Reputation: 9821

Arguably the most important part of this is the "Manifest parsing error: Line: 1, column: 1, Unexpected token"

This means your manifest.json file is invalid - i.e. it's not valid JSON.

Try running it through this for more info: https://manifest-validator.appspot.com/

Once this has been fixed, it will allow Chrome to find your gcm_sender_id and fix the other two problems.

Upvotes: -1

Related Questions