Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.39k stars 1.52k forks source link

Invalid Token when using newly generated P12 #814

Open pauldiston opened 7 years ago

pauldiston commented 7 years ago

What version of PushSharp are you using?

4.0.10

Describe your issue:

I had an email through from Apple saying that my app certificate for Push Notifications was due to expire so I went about creating a new certificate and exporting the P12. However when using this new P12 I get an "Invalid Token" exception. I have tried both a production and sandbox (development) certificate.

What are the steps required to reproduce this issue?

Use the QueueNotification method to send a notification using newly created P12's.

Please provide any Exception Stack Traces

pauldiston commented 7 years ago

After further investigation, I have found that the P12 export needs to occur against the certificate and not the private key.

I seem to have been mislead by the instructions here https://developer.xamarin.com/guides/ios/application_fundamentals/notifications/remote_notifications_in_ios/

Export the Certificate - Expand the certificate so the associated private key is visible, right-click on the key and chose Export. You will be prompted for a filename and a password for the exported file.