I'm trying to generate a developer token with the following code in nodeJS:
const jwt = require('jsonwebtoken')
const {TEAM_ID, KID, APPLE_PRIVATE_KEY } = require('./secret') const expiration = 36000; const currentTime = Math.floor(Date.now() /1000); const expirationTime = currentTime + expiration;
const options = { algorithm: 'ES256', header :{ alg : "ES256", kid : KID } }
const payload = { iss : TEAM_ID, iat : currentTime, exp : expirationTime }
const newToken = jwt.sign(payload, APPLE_PRIVATE_KEY, options)
console.log('1111111111111111111111' , newToken)
When testing my newToken in curl -- I'm getting a 401 response.
Please help.