I need to make an api able to create jira issues on a locally installed server from a third party cloud installed software. So no server to server communication is possible and the only solution is to use the js libraries to make rest calls to the local serve. For a basic example I'm using jquery.
$.ajax({
url: 'http://localhost:8080/rest/api/latest/issue/',
type: "POST",
dataType: 'json',
cache: false,
crossDomain: true,
timeout: 5000,
data: JSON.stringify(fields: {
project: {
key: 'TES'
},
summary: "REST EXAMPLE",
description: "Creating an issue via REST API",
issuetype: {
name: "Bug"
}
}),
xhrFields: {
withCredentials: true
},
headers: {
'Authorization': 'Basic '+window.btoa(user+':'+password),
'Content-Type': 'application/json',
'X-Atlassian-Token': 'nocheck'
},
complete: function(response) {
console.log(response.responseText);
}
});Everything is ok if I execute the script for IE 11 and Firefox (although for Firefox I add an extra 'User-Agent': 'test' header).
But I can't seem to figure out why it won't work for Chrome. The preflight request returns a 200 status but when the actual request is sent, I receive a 403 status with an error: XSRF check failed.
JIRA is installed with all its default packages and I work on a Tomcat 8 server. I configured it to accept the CORS filter, so I don't think it's a server problem, because for IE and Firefox works but not for Chrome.