node apn

158 views
Skip to first unread message

negis...@gmail.com

unread,
May 15, 2017, 7:59:38 AM5/15/17
to node-apn
Hi guys

var apn = require('apn');
var options = {
      token: {
        key: configfile.apnsCertData,
        keyId: configfile.apnsKeyData
      },
      production: false
    };

var apnProvider = new apn.Provider(options);

after node. i got error throw new Error("token.keyId is missing");

any idea why i am getting this error

I have both certificate ---> apns.p12, apns.pem


Intrinsic Innovation

unread,
May 24, 2017, 11:36:51 PM5/24/17
to node-apn
You need to create the authentication token to use the token method. That will generate the *.p8 file. 
Alternatively, if you have p12 file use the following commands to get it working. 

CERT.PEM
________
openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts

Key.pem file
____________
openssl pkcs12 -nocerts -out keyname.pem -in ~/certificate/Certificates.p12
<---------creates encrypted key file----------->
openssl rsa -in keyname.pem -out key.pem

Once you have generated the key.pem and cert.pem use them instead of the token method to send a notification. 

Regards
Umashankar
Reply all
Reply to author
Forward
0 new messages