Comments (6)
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.
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.
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.
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.
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.
You're welcome, thank for the update.
from web-push-csharp.
Related Issues (20)
- Not working on Edge and Safari HOT 1
- Upgrade to .NET 8 HOT 1
- Does this library support Decryption of payload message at endpoint?
- Upgrade to .NET 6
- Support STJ HOT 1
- Unfriendly exceptions are thrown when a malformed p256dh key is provided HOT 1
- WebPushClient: Implement an interface for mocking in UnitTests HOT 1
- SendNotificationAsync not working on Server HOT 1
- Why does NuGet package not updating HOT 1
- Remove Newtonsoft.Json dependency HOT 4
- The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
- .Net - NOT CORE! - Exception thrown: 'System.ArgumentException' in WebPush.dll HOT 1
- .NETStandard 2.0 not supported HOT 1
- Push notification Click Event not firing HOT 1
- Upgrade Portable.BouncyCastle C# .NET 1.8.8 or later. HOT 1
- Error 406 was encountered in sending push request, and the reason could not be found
- Subscription no longer valid. Details: push subscription has unsubscribed or expired.
- Apple web push causing errors HOT 8
- Customize link and icon in notification message HOT 1
- Upgrade to .NET 7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web-push-csharp.