Hey there,
I’m a beginner Programmer and can’t figure out, why I can’t get the Access Token - it always fails with the Base64 encryption. Here is the code (Node.js / VS Code):
const clientID = Buffer.from(process.env.ZOOM_ID).toString('base64');
const clientSecret = Buffer.from(process.env.ZOOM_S_CLIENT).toString('base64');
console.log(clientID);
console.log(clientSecret);
var http = new XMLHttpRequest();
var url = 'https://zoom.us/oauth/token?grant_type=account_credentials&account_id=MYACCOUNTID'; //(I replaced the ID with the text, in my code there is the Account ID)
http.open('POST', url, true);
http.setRequestHeader("Content-Type", "application/json");
http.setRequestHeader('Authorization', 'Basic ' + clientID + ':' + clientSecret);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
console.log(http.responseText);
}
}
http.send();
I log the ID and secret for testing purpose, and they are encrypted. But I always get the error message:
{
"status": false,
"errorCode": -1,
"errorMessage": "Input byte array has incorrect ending byte at 32",
"result": null
}
Can someone point out my mistake, please?