Giter VIP home page Giter VIP logo

Comments (6)

coryjthompson avatar coryjthompson commented on June 12, 2024

Do you have an example of what url are trying to hit in Firefox?
If you were hitting the correct url and the keys were invalid you would receive an Unauthorized.

Thanks for your suggestion regarding adding push subscription details in WebPushException.

from web-push-csharp.

marsimoto03 avatar marsimoto03 commented on June 12, 2024

Sure. Since I used VAPID I got a mozilla endpoint wiht "/v2" i assume. So this is my subscription object:
{ "endpoint": "https://updates.push.services.mozilla.com/wpush/v2/gAAAAABYpESkITzRdLfq5LgF5bTmlKEGv4-LJXtNWVKmYeO9gQhUvvOQjeQKVSDRy-mVbl4g0WroU9XpsSOANHmSyUZaeBKWgyQ6v3hSas5TZRGhG9EFQwiQuCe_f4-MIgk9thBXMKlsUP_nYWUOEu6Ba4fB_VLxH1u5V6ErYvM5647sWQHVmek", "keys": { "p256dh": "BIhG9_nTy0BcXIdEHMVy0bNIMcHL4WGCyC6ETqdGZffMsBzIMBSQaK-7k4PxpxaZu5HK5rvKx-16_yvlJOH67vU", "auth": "DPmRynzG9ijct7znNLEKgw" } }
So I use my generated VAPID application server key to subscribe. In Chrome it works so I thought I should work the same using Firefox.
Thank you for your help!

from web-push-csharp.

coryjthompson avatar coryjthompson commented on June 12, 2024

That looks correct to me - are you sending a payload? If not, can you try sending an arbitrary string as the payload. If that fails would you mind sharing code?

from web-push-csharp.

marsimoto03 avatar marsimoto03 commented on June 12, 2024

Yes, I send some payload with it - an object containing data that was stringified for sending.
I will try just sending a string, but you will have to wait for my response till monday because I'm not at work today.

from web-push-csharp.

marsimoto03 avatar marsimoto03 commented on June 12, 2024

So I looked into it and it was totally my mistake. In the past I saved the subscription object (in this case the endpoint) in the database without the trailing "push vendor url" (like https://updates.push.services.mozilla.com/wpush/v2/). With the use of your library I had to concatenated the url to the device key when sending a push notification and therefore I decided to save the whole endpoint url in the database. But my code still concatenated the url to the so I ended up with https://updates.push.services.mozilla.com/wpush/v2/https://updates.push.services.mozilla.com/wpush/v2/gAAAAABYpESkITzRdLfq5... . Google / FCM is be able to handle it. I debugged it before but I didn't notice it.

Thanks again for your help and I'm looking forward to the detailed WebPushException (I saw you already implemented it)!

from web-push-csharp.

coryjthompson avatar coryjthompson commented on June 12, 2024

You're welcome, thank for the update.

from web-push-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.