zaru / webpush

webpush, Encryption Utilities for Web Push protocol
MIT License
396 stars 73 forks source link

Importing users from OneSignal gives Net::HTTPForbidden 403 MismatchSenderId #66

Closed Rubioli closed 5 years ago

Rubioli commented 5 years ago

I've built my own platform for internal usage and imported all of my users from OneSignal over to my application, but when I sent any notification to any of them, I get: Webpush::Unauthorized exception & Net::HTTPForbidden 403 MismatchSenderId

Webpush::Unauthorized in PushSenderController#push_tester_sender

host: gcm-http.googleapis.com, #<Net::HTTPBadRequest 400 UnauthorizedRegistration readbody=true> body: <HTML> <HEAD> <TITLE>UnauthorizedRegistration</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>UnauthorizedRegistration</H1> <H2>Error 400</H2> </BODY> </HTML>

skjermbilde 2019-03-06 18 55 24

Anyone knows how I can solve this?

I appreciate any help and thanks in advance! 💯

rossta commented 5 years ago

Try working through the usage steps in the README to be sure all your settings are correct: https://github.com/zaru/webpush#usage

collimarco commented 5 years ago

403 MismatchSenderId means that you are using the wrong GCM key. Basically means that your subscriptions are associated to key1 for example, but you are signing the requests using key2. You can fix the error by using the correct key to sign the requests.

Also note that GCM (gcm-http.googleapis.com) is going to be shut down within a few weeks, so your request will fail in any case.

This is clearly not an issue related to the library and I suggest to close (@zaru): StackOverflow is a better place for this kind of questions.