• Community
  • Questions
  • Cannot authenticate to JIRA 5.1.8 using RESTful API using curl command

Cannot authenticate to JIRA 5.1.8 using RESTful API using curl command

I have got 'Login Failed' Error when I try to connect to JIRA 5.1.8 using REST API.

$ curl -X POST -H "Content-Type: application/json" -d '{"username" : "APP_USERNAME"
, "password" : "APP_PASSWORD"}' https://jira.company.com/rest/auth/1/session

{"errorMessages":["Login failed"],"errors":{}}

JIRA URL (https://jira.company.com) which has SITEMINDER Integration and /rest is the unprotected URL in siteminder, I should be able to access JIRA directly using curl command.

My username and password are correct and can able to login successfully through JIRA Interface.

I tried this command in JIRA Development Instance which does not have siteminder integration, I got the response.

$ curl -X POST -H "Content-Type: application/json" -d '{"username" : "APP_USERNAME"
, "password" : "APP_PASSWORD"}' http://localhost:8080/rest/auth/1/session


Why it is not working in the environment which has siteminder integration ? Do I need to provide any other valid information to the curl command ?

3 answers

Hi Alagu,

Can you try the following cURL command instead:

curl -u admin:admin -b cookie_jar -c cookie_jar -X GET http://localhost:8080/jira/rest/auth/latest/session

I hope that this will help.


$ curl -u username:password -b cookie_jar -c cookie_jar -X GET "https://jira.ce

Got UnAuthorised(401) Error.

$ curl -u username:password -b cookie_jar -c cookie_jar -X GET "https://jira.ce
<title>302 Found</title>
<p>The document has moved <a href="/lp/login.html?TYPE=33554432&amp;REALMOID=06-

Here I didnt get the session resonse.

NOTE: The website https://jira.cert.sabre.com has SiteMinder Integration.

$ curl -X POST -i -H "Accept: application/json" -H "Content-Type: application/j
son" -d '{"username":"APP_USERNAME","password":"APP_PASSWORD"}' https://jira.cert.sabre
HTTP/1.1 401 Unauthorized
Date: Fri, 22 Feb 2013 07:13:53 GMT
Server: Apache
X-AREQUESTID: 73x30476x1
Set-Cookie: atlassian.xsrf.token=AE0B-V25N-QYAS-MPMR|1bf6ed3ee0ab1c66df5e11400ea
f8d71ad16b021|lout; Path=/
X-AUSERNAME: anonymous
WWW-Authenticate: JIRA REST POST
WWW-Authenticate: OAuth realm="https%3A%2F%2Fjira.cert.sabre.com"
Content-Length: 46
Content-Type: application/json;charset=UTF-8

{"errorMessages":["Login failed"],"errors":{}}

Can you please let me know why I am getting this error, even I can able to login through JIRA Interface. Here X-AUSERNAME is mentioned as Anonymous.

Hi Alagu,

Since you have SiteMinder integrated with JIRA, most likely you are getting the error code 401 (unauthorized) because the REST request needs to go through SiteMinder first.

Hence in order to try if you can authenticate to JIRA using REST, then I believe that you will have to bypass the SiteMinder, and test the cURL command again.

One way to test this is to deploy a test JIRA installation without SiteMinder integration, and try to run the command again.


Hi, Thank you for your response !

/rest is the unprotected URL in Siteminder , so it is out of sideminder's SSO scope.

But when I see the error, Path is / which is a protected URL in siteminder.

Set-Cookie: atlassian.xsrf.token=AE0B-V25N-QYAS-MPMR|1bf6ed3ee0ab1c66df5e11400ea
f8d71ad16b021|lout; Path=/

I am trying to access /rest, but the error which i got is for the path /

Please suggest.

  1. Build a string of the form username:password
  2. Base64 encode the string
  3. Supply an "Authorization" header with content "Basic " followed by the encoded string. For example, the string "fred:fred" encodes to "ZnJlZDpmcmVk" in base64, so you would make the request as follows.
curl -D- -X GET -H "Authorization: Basic ZnJlZDpmcmVk" -H "Content-Type: application/json" "http://kelpie9:8081/rest/api/2/issue/QA-31"

Even I am facing same issue when using REST API for Basic Authentication. Here is curl command:

curl -D- -X GET -H "Authorization: Basic base64encodeduser:pass" -H "Content-Type: application/json" "https://hostname.com/jira/rest/api/2/issue/createmeta"

I also tested with "Postman" google chrome app for auth verification. But not successful.

This is Authentication denied header of response.


How can I find, whether this particular server allows basic authentication or not?

I am writing some application to produce some custom report with all open issues in JIRA. But, authentication itself not successful.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

288 views 38 9
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