According to: https://developer.atlassian.com/cloud/jira/service-desk/rest/#authentication
"Authentication for REST API requests
If you are integrating directly with the Jira Service Desk Cloud REST APIs it is recommended to use OAuth authentication method. For implementations with low security requirements, such as scripts and bots, it is also possible to use Basic authentication method."
We have a web application e.g. https://xxx.globetax.com that needs to submit a POST to '//xxx.atlassian.net/rest/servicedeskapi/request' using the following code (basic auth):
var request = {
serviceDeskId: 'xx',
requestTypeId: 'yyy',
requestFieldValues: {
summary: 'Inquiry about Claim #' + zzz,
description: aaa
},
requestParticipants: [bbb]
}
const tok = 'USER:PASS'
const hash = btoa(tok)
const parameters = JSON.stringify(request)
$.ajax({
url: ccc,
type: 'POST',
data: parameters,
contentType: 'application/json',
dataType: 'json',
async: false,
processData: false,
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Basic ' + hash)
}
})
.done(function(json) {
})
.fail(function(jqXHR, textStatus, error) {
})
Is there a way to achieve that from JavaScript / XHR - is there a way to allow our origin (seems the answer is no, if so, what was the intent of the API for the Jira Service Desk Cloud REST API)?