Home » Php » Safari Push Notifications: How to get feedback when user change permission?

Safari Push Notifications: How to get feedback when user change permission?

Posted by: admin October 29, 2018 Leave a comment

Questions:

I’ve implemented Safari Push Notifications by using JS & PHP. I can check for permission, request for permission and push the notification.

The only problem is that it looks like the request is not sent back on the first grant permission or later when they change their permission.

The request should be send back to this endpoint:
webServiceURL/version/devices/deviceToken/registrations/websitePushID

And this is my .htaccess rule:
RewriteRule ^v2/devices/(.?)/registrations/(.?)$ api/push/v1/indexDevice.php [L]

If I try to do this manually it works, but not when permission is changed in Safari and I need this to work so I get deviceToken back from Apple.

What am I doing wrong, any suggestions?

Apple documentation:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NotificationProgrammingGuideForWebsites/PushNotifications/PushNotifications.html

Answers: