I have a Google Script running as part of Sheet that fetched some tickets from out Jira board using basic authentication and JQL.
The JQL works perfectly fine when run from command line via curl (ubuntu) but shows the following error when executed from Google Script -
{"errorMessages":["Field 'assignee' does not exist or this field cannot be viewed by anonymous users."],"errors":{}}
This is how I'm making the curl request -
curl -H "Authorization: Basic <base64 encoded username:password>" -X GET -H "Content-Type: application/json" https://<jira_host>.com/rest/api/2/search?jql=<JQL>
and this is how I'm doing it form Google Script -
var url = encodeURI(host + 'rest/api/2/search?jql=' + jql);
var params = {};
params['header'] = {'Authorization': PropertiesService.getUserProperties().getProperty('AUTH')};
params['Content-Type'] = 'application/json';
params['Accept'] = 'application/json';
params['method'] = 'GET';
params['muteHttpExceptions'] = true;
var response = UrlFetchApp.fetch(url, params);
I referred JIRA Basic Authentication guide's CAPTCHA section to see if I'm being denied authentication but I confirmed that this is not the case by verifying response headers.
I'm not sure what am I doing incorrectly to cause this error. Any help is appreciated.
Thanks.