GoogleChromeLabs / web-push-codelab

Other
556 stars 289 forks source link

push event authorization #63

Open Myeongjoon opened 7 years ago

Myeongjoon commented 7 years ago

link : https://developers.google.com/web/fundamentals/codelabs/push-notifications/?hl=ko I followed uppper link.

  1. Downloaded code https://github.com/GoogleChrome/push-notifications.git.

  2. using web server for chrome, started completed/8-push-subscription-change

  3. In http://127.0.0.1:8887/ view, clicked enable push messaging button and copy entire json message(endpoint,p256h,auth) like docs.

  4. In https://web-push-codelab.glitch.me/ pasted copied json message toSubscription to Send To

  5. type Text to Send and click send push message button

result alert : <HTML> <HEAD> <TITLE>UnauthorizedRegistration</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>UnauthorizedRegistration</H1> <H2>Error 400</H2> </BODY> </HTML>

Is there any solution?

kenrick95 commented 7 years ago

Have you edited app/scripts/main.js's applicationServerPublicKey? (Related tutorial: https://codelabs.developers.google.com/codelabs/push-notifications/#2 at section "Get Application Server Keys") Thanks

gauntface commented 7 years ago

This is most likely the cause of the problem.

If anyone has any bright ideas for ways to check and highlight this issue - I'm all ears. The glitch.me page has been crazy helpful for making this codelab a little easier to work with, but this is probably the one place a lot of people still get tripped up on.