Hi developers,
I am struggling with this for days now. And I have no idea what to try anymore.
I am making trying to get data from JIRA. But therefor I have to authenticate myself (obviously). But when I do, i get 2 errors:
I have whitelisted my domainname in JIRA as the following:
http://subdomain.mydomain.nl/*
and checked the checkbox that is is allowed to collect / send data.
This is the request I am sending using my application:
var data = { 'username': '[myUsername]', 'password': '[myPassword]' }; $.post('https://[myJira]/rest/auth/1/session/', data, { dataType: 'json', headers: { 'ContentType': 'application/json; charset=utf-8', }, type: 'POST', crossDomain: true, success: function(data) { console.log(data); } });
Is there anyone who can tell me how to get rid of the errors and receive the data I need for my application?
Thank you!
Kind regards,
B. Roelofs
Community moderators have prevented the ability to post new answers.
Maybe not needed anymore, but as a work-around for Cloud you can use:
I hope this helps.
Hi Bart,
I guess you need to remove "dataType:
'json'
,". It expects plain post data rather than json.
Also you can authenticate your requests via BASIC AUTH headers. More info: https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-basic-authentication
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Volodymyr,
Thanks for your response! I am getting a 200 succes message back.
But the ajax still fails, due the Access-Control-Allow-Origin error. Any idea where to look? The white-list looks fine to me. But no idea what else it could be.
Kind regards,
Bart Roelofs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I assume that your JS is run form other domain than your JIRA. Try to add the domain to JIRA white-list: https://confluence.atlassian.com/adminjiraserver071/configuring-the-whitelist-802593145.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not seeing the whitelist configuration based on the link you gave. I'm already a site admin on my confluence site. Is there a special type of role to enable the whitelist configuration? Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Volodymyr Krupach @Bart Roelofs
I add whitelist of my domain, but there are still 415.
$http.post(url, userObj, {
headers: {
'Content-Type': 'application/json'
}
})
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.