How to configure JIRA API for allowed for cross-origin HTTP request

Viewed 770

I want to integrate my app with JIRA, so when I send request to JIRA server its returns error call 'XMLHttpRequest cannot load https://*********/rest/api/2/project. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.'

This is my code

    $http({
        method: "GET",
        url: "https://***********/rest/api/2/project",
        headers: {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin': '*******',
            '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);
    });

};
0 Answers
Related