API Endpoint: https://zoom.us/oauth/token
I am trying to generate an access token for use in further API calls using Google Apps Script (Which is essentially Javascript).
The error that I am getting is: (I have added spaces to the links in order to make this post)
"Exception: Request failed for h tt ps://zoom. us returned code 405. Truncated server response: <!doctype html> <head prefix=“og: h tt p:// ogp. me/ns# fb: h tt p:// ogp. me/ns/fb# zoomvideocall: ht…”
My approach is as follows:
function getAccessToken()
{
//declare clientID, secret, encoded header, and URL
const username = "uxxxxxxxxxx";
const password = "pxxxxxxxxxx";
const accessHeader = ('Basic ' + Utilities.base64Encode(username + ':' + password));
const accessOptions = { 'headers' : { 'method' : 'GET', 'Authorization' : accessHeader, muteHttpExceptions: true}}
const postURL = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id=xxxxxxxxxxxxxxxx";
//send POST API request
const postResponse = UrlFetchApp.fetch(postURL, accessOptions);
var postJSON = postResponse.getContentText();
var postData = JSON.parse(postJSON);
//get access token
var accessToken = postData.access_token;
}
I am not sure what I am doing wrong as I have read through the documentation for both Zoom and AppsScript regarding authentication and it looks to me that everything is correct. Any help would be appreciated.