Open lamlejobchat opened 3 years ago
Currently. I'm using config bellow with a p8 file (APNsAuthKey_XXXXXXXXXX.p8). I found that in the p8 file, content is a string of a private key. How to use a key string instead of a p8 file?
const options = { token: { key: 'path/to/APNsAuthKey_XXXXXXXXXX.p8', keyId: process.env.APPLE_KEY_ID, teamId: process.env.APPLE_TEAM_ID, }, production: process.env.APP_ENV === 'prod', };
@lamlejobchat As i know just have 2 option: string (path to your key file) and Buffer and if you dont want to use p8 file, you can use option below. let bufferKey = fs.readFileSync('path/to/APNsAuthKey_XXXXXXXXXX.p8'); const options = { token: { key: bufferKey , keyId: process.env.APPLE_KEY_ID, teamId: process.env.APPLE_TEAM_ID, },
you could do it like below.
const key = `-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCxxxxxxxxxxxxxxx
-----END PRIVATE KEY-----`
const options = {
token: {
key: key,
keyId: "xxxx",
teamId: "xxxx"
}
}
Currently. I'm using config bellow with a p8 file (APNsAuthKey_XXXXXXXXXX.p8). I found that in the p8 file, content is a string of a private key. How to use a key string instead of a p8 file?
const options = { token: { key: 'path/to/APNsAuthKey_XXXXXXXXXX.p8', keyId: process.env.APPLE_KEY_ID, teamId: process.env.APPLE_TEAM_ID, }, production: process.env.APP_ENV === 'prod', };