appfeel / node-pushnotifications

Push notifications for GCM, APNS, MPNS, AMZ (automatic detection from device token)
MIT License
534 stars 126 forks source link

How to connfig apn certificate #66

Closed wcyyo closed 6 years ago

wcyyo commented 6 years ago

Api said use p8 and team ID to config, but there is p12 file .Could i use this p12 file to certificate?

ChildishDanbino commented 6 years ago

Hey. Not sure if there is a better way to use p12 files... if there is I hope someone can correct me. But I was able to get this to work by using my p12 file and cert. I'll try and do my best to explain the steps.

  1. Place the p12 file and cert file on the desktop (make sure they are named cert.cer and key.p12.. if not rename them)

  2. Cd into the desktop on terminal and run the following commands openssl x509 -in cert.cer -inform DER -outform PEM -out cert.pem openssl pkcs12 -in key.p12 -out key.pem -nodes

  3. Move the PEM files into your server. ( I placed them in a certs directory)

  4. Set the following as your config

    apn: {
      key: './certs/key.pem',
      cert: './certs/cert.pem'
    }
  }

Use like so const push = new PushNotifications(config.pushNotifications)

Hope that helps!

alex-friedl commented 6 years ago

Closing this for inactivity. Thanks for your help @Daadler6