Send "grant_type = client_credentials" as a payload.
var options = {
"method":"post",
"headers": {
"Authorization":"Basic " + Utilities.base64Encode(param),
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"
},
"payload" : "grant_type=client_credentials"
};
var response = UrlFetchApp.fetch(TOKEN_URL,options);
Jflox source
share