ruby - Chrome notification with rails - 400 UnauthorizedRegistration -


i`m using rails , https://github.com/zaru/webpush gem , have configured things according guide https://rossta.net/blog/web-push-notifications-from-rails.html

i manage register serviceworker , subscription. save in controller

endpoint = params[:subscription][:endpoint] p256dh = params[:subscription][:keys][:p256dh] auth = params[:subscription][:keys][:auth]  current_user.gcm_endpoint = endpoint current_user.gcm_p256dh = p256dh current_user.gcm_auth = auth 

later send message this:

message = {     title: "title",     body: "this test notification",     icon: "images/my-128.png" }  webpush.payload_send(     endpoint: current_user.gcm_endpoint,     message: json.generate(message),     p256dh: current_user.gcm_p256dh,     auth: current_user.gcm_auth,     ttl: 600,     api_key: "<my api key>" ) 

i have configured , activated account on google console. have turned on gcm api , added correct key. no matter do, receive 400 error code. , have no stats in google console - if no calls made api call.

the problem in key itself. need generate using separate firebase control panel. here key code works well.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -