After successfully certify my package with PHP and deliver it to Safari through endpoint /v1/pushPackages/web.com.mywebsite
, the so expected popup appeared:
Three problems now happen:
granted
condition.I can select the item an press the button "Remove", restart the Safari and my website will ask again for permissions, but the problem persists. My log files are empty, no error is thrown!
var checkSafariPermission = function (permissionData)
{
if (permissionData.permission === 'default')
{
window.safari.pushNotification.requestPermission(
'https://mywebsite.com',
'web.com.mywebsite',
{},
checkSafariPermission
);
} else if (permissionData.permission === 'denied')
{
console.log('denied');
} else if (permissionData.permission === 'granted')
{
// This is never triggered!
console.log('Device token: ' + permissionData.deviceToken);
}
};
var permissionData = window.safari.pushNotification.permission('web.com.mywebsite');
checkSafariPermission(permissionData);
I have the routes:
POST /v1/devices/{deviceToken}/registrations/web.com.mywebsite
DELETE /v1/devices/{deviceToken}/registrations/web.com.mywebsite
Ready to receive data, but I don't think Safari is yet requesting this routes.
The official documentation says the following:
Important: Make sure that your web server is using a real certificate issued from a Certificate Authority, not a self-signed certificate. If your certificate is self-signed, push notifications won’t reach your users.
Could this be the problem? Currently my website has an certificate called "Let's Encrypt Authority X3", with the bellow data, but I don't know if this is a self-signed certificate?
Common name: www.mywebsite.com
SANs: mail.mywebsite.com, mywebsite.com, webmail.mywebsite.com, www.mywebsite.com
Valid from November 10, 2020 to February 8, 2021
Serial Number: 046829bc4b1e9d71ed27b...
Signature Algorithm: sha256WithRSAEncryption
Issuer: Let's Encrypt Authority X3
UPDATE 1 - I just acquired & installed a certificate, the problem persists
Solved.
It wasn't a problem due to Safari, but yes to the fact that I was using a Virtual Box with OS X. With a real macOS it worked great!
Yet, make sure you have an valid certificate, because that is still required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With