mac-cain13 / notificato

Takes care of Apple push notifications (APNS) in your PHP projects.
MIT License
224 stars 44 forks source link

Certificate Name (CN) not correctly defining APNS environment #53

Closed chorsnell closed 8 years ago

chorsnell commented 8 years ago

Noticed now Apple are naming their APNS certificates differently.

They are named Apple Push Services rather than specificly Production or Development

https://github.com/mac-cain13/notificato/blob/master/src/Wrep/Notificato/Apns/Certificate.php#L149

As they are now merging the two, unsure how accurately it would detect the correct environment to use, however got it working by adding an extra condition to catch the updated name and point to production.

mac-cain13 commented 8 years ago

Thanks for reporting this! I think we should inspect what CN Apple uses in new certificates and update the detection accordingly. Maybe even by inspecting other fields.

I'm not sure when I have time to do this and release a new version. I'm open to a PR resolving this issue, so feel free to create one. If someone has the time to give information about what certificates have what metadata now that would also help a lot!

chorsnell commented 8 years ago

No worries. So it looks like they have merged the two: http://stackoverflow.com/questions/34431337/apple-push-services-created-instead-of-apple-production-ios-push-services

As mentioned in the SO, you can request dev only certs still, however production certs will work now for both gateways. Looking in the certs I can no longer see anything we can rely on to tell the difference.

Feels like the endpointEnv may need to be manually toggled, in the instance that you are using a production + dev cert, but want a specific endpoint. If I get time (and if you agree) I will submit a PR.

mac-cain13 commented 8 years ago

Well the new certs are basically production certificates that also work with the development environment. So I think we should add the new CN to the ifs and make it choose the production env. You can always override this and force it to use develop if you want to.

mac-cain13 commented 8 years ago

I've now released 1.2.0 that should fix this issue!