const appstoreDownloadsCall = () => {
.....
let payload = {
"iss": issuerId,
"exp": nowPlus20,
"aud": "appstoreconnect-v1"
}
let signOptions = {
"algorithm": "ES256",
header : {
"alg": "ES256",
"kid": apiKeyId,
"typ": "JWT"
}
};
token = jwt.sign(payload, privateKey, signOptions);
console.log('@token: ', token);
var options = {
host: 'api.appstoreconnect.apple.com',
path: 'xxxx',
method: 'GET',
headers: {
'Accept': 'application/a-gzip, application/json',
'Authorization' : 'Bearer ' + token
}
};
.......
}