Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight

im not what i did but i have been having error with my front end app communicating with JIRA via REST API. i need to create issues via my app and send a  POST request. but i am really having errors with CORS. i have asked our server techs to add the response headers the webxml as instructed here.

 

https://community.atlassian.com/t5/Answers-Developer-Questions/Cross-Origin-Resource-Sharing-with-JIRA-REST-API-and-Javascript/qaq-p/484801

 

and other resources. but they didnt work my jira dev environment is not accessible everytime i update my webxml. i walways get error 404. so we had to refresh the changes. 

 

anyway when i ran the code, i didnt get the usual CORS issue error i have but i had this error in chrome:

 

XMLHttpRequest cannot load https://jira-dev.....org/rest/api/2/issue/. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.

here is my code:

 

return $.ajax({
url: 'https://jira-dev.cambridge.org/rest/api/2/issue/',
type: "POST",
data: parameters,
contentType: 'application/json',
//contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
dataType: 'JSON',
async: false,
processData: false,
crossDomain: true,
xhrFields: {
withCredentials: true
},
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'basic: '+make_base_auth(username, password));

},
error: function (errmsg) {
//console.log('error ocured:' + errmsg.statusText);
return errmsg;
},
success: function (text) {
//console.log(text);
return text;
},

 

0 answers

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,305 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot