For a Cordova app I want to send a notification using Apple Push Notification service to an iPhone running iOS 10.1. When the back end connects to the Apple service to deliver a notification the connection fails with an invalid token.

I have tried both the production and sandbox environments of APNS, using the same .pem file. Both fail.

The app uses the Cordova Push Notification plugin for notifications.

The app was registered with have a certificate that includes the use of push notifications. From this a .pem file was created and uploaded to the server.

In Xcode (8.1) I let Xcode manage code signing automatically and picked our team. I switched on Push Notification in the capabilities tab.

The app is launched from Xcode to a connected iPhone. Registering in the app for push notification succeeds, I see the dialog to allow notification and the app sends the registration information to the back end.

Is there something I need to configure in Xcode, on the server or perhaps in the app registration?