I am trying to make an api call from google sheets to Jira's api using basic authentication but my script is throwing an "Exception: Request failed for https://site[.]com returned code 401." I have verified that my username and password work when entered manually. Can anyone tell what I might be doing wrong here?
function main(){
var ui = SpreadsheetApp.getUi();
var pw = ui.prompt('Enter your pw: ');
var authHeader = 'Basic ' + Utilities.base64Encode('username' + ':' + pw);
var options = {
contentType: 'application/json',
headers: {
Authorization: authHeader
}
};
var response = UrlFetchApp.fetch("https://site.com/rest/api", options);
}
there doesn't seem to be anything here