How to set up JIRA API to allow cross-origin HTTP request
I want to integrate my application with JIRA, so when I submit a request to the JIRA server, it returns an error saying " XMLHttpRequest cannot load https: // ********* / rest / api / 2 / project. Pre-flight request response fails access control check: the requested resource does not have an "Access-Control-Allow-Origin" header. '
This is my code
$http({
method: "GET",
url: "https://***********/rest/api/2/project",
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'https://duosoftware.atlassian.net',
'Access-Control-Allow-Methods': 'GET, POST, DELETE, PUT, OPTIONS',
'Access-Control-Allow-Headers':'X-Requested-With, Content-Type, X-Codingpedia,Authorization'
},
dataType: "jsonp",
}).then(function mySuccess(response) {
$scope.myWelcome = response.data;
console.log(response.data);
}, function myError(response) {
$scope.myWelcome = response.statusText;
console.log(response.statusText);
});
};
+3
source to share
1 answer
I think the problem you are having can be fixed from the following url. https://developer.atlassian.com/static/connect/docs/latest/javascript/module-request.html
0
source to share