My company uses SSO for authenticating into Jira. I'm currently trying to run a few curl commands using the Windows CMD before I put it into a small application(probably excel creating a bat file and submitting it) to create a number of Jira's.
My company uses SSO for authenticating into Jira, but I understand that Basic Authentication is enables because I can see " WWW-Authenticate: Basic realm="protected-area" when I run
curl -v https://CompanyJiraServer/rest/auth/1/session?os_authType=basic
My Problem is that I cannot get myself authenticated using the rest API method. One of the problems I see is this : X-AUSERNAME: anonymous no matter which command/method I try to access any of the Jira API and mostly receive a LOGIN FAILED or a 401 result at the end. I have almost read a lot of posts here related to Authentication issues and tried many suggestions, but I'm still stuck with this issue.
Examples of what I have tried:
Creds.txt contains
{
"username":"x12345",
"password":"Pass123"
}
curl -i -H "Content-Type: application/json" -X POST -d @Creds.txt https://CompanyJiraServer/rest/auth/1/session
HTTP/1.1 401
X-AREQUESTID: 937x11282851x2
X-ASEN: SEN-9487476
Set-Cookie: atlassian.xsrf.token=BUSN-XL15-O7QK-OYZZ|a2dcb105cbce5c8f2e01358a19bb4ae4dbb485fa|lout;path=/;Secure
X-AUSERNAME: anonymous
X-Seraph-LoginReason: AUTHENTICATED_FAILED
WWW-Authenticate: JIRA REST POST
Cache-Control: no-cache, no-store, no-transform
X-Content-Type-Options: nosniff
WWW-Authenticate: OAuth realm="https://CompanyJiraServer"
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 10 Dec 2018 14:37:02 GMT
{"errorMessages":["Login failed"],"errors":{}}
I have even tried "Authorization: Basic WDE3NjQ3MTpOb3ZlZ" instead of supplying a file and also provided the json on the command line. {"username":x12345,"password":Pass123"}
curl -X GET -D- -u "x12345:Pass123" -H "Content-Type: application/json" https://MyCompanyServer/rest/api/2/issue/PROJ-1304
I have tried the similar methods using my browser after the usual sso authentication and can see the json results for PROJ-1304 and many other URLs, so no issues with access.
Apologies for the long post. If you have some options for me to try, please let me know.