Use p8 string instead of file

335 views
Skip to first unread message

Olav Gausaker

unread,
Apr 26, 2017, 7:58:39 AM4/26/17
to node-apn
Hi!

Is there a way to use the string on the p8 file instead of the p8 file instead? I mean, instead of this:

token: {
key: "key.p8",
keyId: "ABCDEFGHI",
teamId: "JKLMNOPQR"
}

...use this:

token: {
key: "MJHGgfdDUYTgfdFDsasFGH...",
keyId: "ABCDEFGHI",
teamId: "JKLMNOPQR"
}

Thanks!

Nesim Sisa

unread,
Sep 14, 2017, 7:24:09 PM9/14/17
to node-apn
YES
  Luckily there is the typescript definition for the package!
which shows the string version can be passed as well:
/**
* The filename of the provider token key (as supplied by Apple) to load from disk, or a Buffer/String containing the key data.
*/
key: Buffer|string;

Akshay Mehta

unread,
Dec 30, 2017, 4:49:37 AM12/30/17
to node-apn
I get this error - even if I send the full key string or if I send the filename/path:

Failed loading token key: fs.readFileSync is not a function. (In 'fs.readFileSync(value)', 'fs.readFileSync' is undefined)

Please advise.

Thanks
Reply all
Reply to author
Forward
0 new messages