This thread has been locked.

TI-API: invalid client (Google Apps Script, JavaScript)

Part Number: TI-API

Hi TI supports,
I am using Google Apps Scripts to access the API. When I send the following code to TI-API, it always return "error": "invalid_client".
The client ID and SECRET are valid and can run in python and TI test website.
Not sure what happened, could you provide a JavaScript example or help me to dragonize the following codes?
Thank you very much! 
--------------------codes-----------------
/** Documemtation for TI-OAuth: api-portal.ti.com/store-api-authentication 
 ** Documentation for TI-Inv: api-portal.ti.com/store-inventory-pricing-api 
 ** Sample Code that I use (Notion.gs): github.com/.../apps-script-oauth2
 **/

var GRANT_TYPE = 'client_credentials'

var CLIENT_ID = 'xxxxxxxxxmaskedxxxxxxxxxx';
var CLIENT_SECRET = 'xxxxxxxxxmaskedxxxxxxxxxx';

/** * Authorizes and makes a request to the Texas API. */

function run() {
  var service = getService_();
  if (service.hasAccess()) {
    var url = 'transact.ti.com/.../oauth';
    var options = {
      'methods':'post',
      'contenttype' : 'application/x-www-form-urlencoded',
      'muteHttpExceptions'true,
      headers: {
        Authorization'Bearer ' + service.getAccessToken(),
      }}
    var response = UrlFetchApp.fetch(urloptions);
    var result = JSON.parse(response.getContentText());
    Logger.log(JSON.stringify(resultnull2));
  } else {
    var authorizationUrl = service.getAuthorizationUrl();
    Logger.log('Open the following URL and re-run the script: %s',
        authorizationUrl);
  }
}

/** * Reset the authorization state, so that it can be re-tested. */
function reset() {
  getService_().reset();
}

/** * Configures the service. */
function getService_() {
  return OAuth2.createService('TexasGetService')
      // Set the endpoint URLs.
      .setAuthorizationBaseUrl(
          'transact.ti.com/.../oauth')
      .setTokenUrl(
          'transact.ti.com/.../accesstoken')
      .setTokenHeaders({ 
      'Authorization''Basic ' + Utilities.base64Encode(CLIENT_ID + ':' + CLIENT_SECRET)})

      // Set the client ID and secret.
      .setClientId(CLIENT_ID)
      .setClientSecret(CLIENT_SECRET)

      // Set the name of the callback function that should be invoked to
      // complete the OAuth flow.
      .setCallbackFunction('authCallback')

      // Set the property store where authorized tokens should be persisted.
      .setPropertyStore(PropertiesService.getUserProperties())

   ;
}

/**
 * Handles the OAuth callback.
 */
function authCallback(request) {
  var service = getService_();
  var authorized = service.handleCallback(request);
  if (authorized) {
    return HtmlService.createHtmlOutput('Success!');
  } else {
    return HtmlService.createHtmlOutput('Denied.');
  }
}

/**
 * Logs the redict URI to register.
 */
function logRedirectUri() {
  Logger.log(OAuth2.getRedirectUri());
}

**Attention** This is a public forum