web-push-csharp icon indicating copy to clipboard operation
web-push-csharp copied to clipboard

Apple web push causing errors

Open briwg opened this issue 2 years ago • 8 comments

Hi,

I'm starting to see registrations for Apple web push and they are causing errors such as:

Exception thrown: 'System.AggregateException' in mscorlib.dll An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code One or more errors occurred.

I'm using the latest version of the dll.

Thanks

Brian

briwg avatar Jan 16 '23 13:01 briwg

@briwg based on the readme file, the Safari browser is not supported. image Meanwhile, on the node.js package(https://github.com/web-push-libs/web-push), the safari browser is supported

keke1210 avatar Jan 19 '23 17:01 keke1210

Yes, I understand that. However, the point is that people can land on my website using IOS Safari and subscribe to Push Notifications. When I then send out a PN an uncaught exception is thrown by the dll when the apple endpoint is encountered and my sender errors and stops. I have put a workaround in place, but the dll in my view should either a) handle the exception internally b) be updated to support Apple IOS push notifications since it appears they are now finally being rolled out.

briwg avatar Jan 19 '23 17:01 briwg

@briwg I am rooting for option b.

keke1210 avatar Jan 19 '23 18:01 keke1210

Safari for MacOS have full support for standard PUSH API which works perfectly with this library. According to presentation, support for iOS and iPadOS will appear next year.

But unfortunately, the library looks abandoned and is no longer being developed.

WebPush for Safari

7702244 avatar Jan 23 '23 13:01 7702244

So i believe i have found the issue here...

After searching through the differences from the main js project and this one, i noticed that this library does not support the content encoding AES_128_GCM which is required by safari as you can see in the Authorization header description here: Send push notifications to Safari users

This feature is requested since 2018...: 44

Stratster avatar Mar 28 '23 12:03 Stratster

I ran into a similar (but maybe not the same) problem where I got "403 - BadJwtToken" as an error.

The solution to my problem was to remove the "<" and ">" from the mailto in the VAPID subject (from mailto:<[email protected]> to mailto:[email protected]). It seems that Apple does not like them. (see https://stackoverflow.com/questions/75547851/sending-push-notifications-to-safari-from-java)

Push notifications now work fine for me (Safari on iOS) using this library. Hope this helps.

DaBeSoft avatar Apr 13 '23 10:04 DaBeSoft

DaBeSoft do you know if this works with iOS and iPadOS 16.4 devices which support web push?

See: https://webkit.org/blog/13878/web-push-for-web-apps-on-ios-and-ipados/

briwg avatar Apr 30 '23 16:04 briwg

Yes, it does work, but afaik the web app needs to be added to the homescreen for Push Notifications to work on iOS / iPadOS (as described in your link).

DaBeSoft avatar May 02 '23 06:05 DaBeSoft