Error 405 when attempting to generate an OAuth access token

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.

@cody.nason,

Thank you for posting in the Zoom Developer Forum – I am happy to help. I am not familiar with Google Apps Script. However, if it is essentially Javascript, you should be able to reference our Sample OAuth apps for implementation guides. I’ve linked our OAuth and Server-to-Server Sample for your reference below.

Zoom OAuth Hello World

Zoom Server-to-Server (s2s) Oauth Token Generation

Let me know if this helps.