JIRA API Authentication - Cookie - No JSESSIONID but cloud.session.token Edited

I got this as response on trying to authenticate using rest/auth/1/session 

{"session":{"name":"cloud.session.token","value":"eyJraWQiOiJzZXNzaW9uLXN

Can i use this as JSESSIONID  ?

Another case is 

I am able to connect using Basic authentication after that am stuck. After login if there is a redirect ,   do i have to authenticate again on the new page ? So if i have multiple pages do i have to authenticate each time if i am using Basic Auth ?

 

2 answers

Hi Leo,

The documentation needs to be updated as mentioned in:

In  order to make it working you just store all the cookie information in a file and use that to authenticate. E.g.:


1) Store the cookie in a cookie jar: 

curl -c cookie.txt -H "Content-Type: application/json" -d '{"username":"XXXXXXXXX", "password":"XXXXXXXXX" }' -X POST https://INSTANCE/rest/auth/1/session

OR

curl --cookie-jar cookie.txt -H "Content-Type: application/json" -d '{"username":"XXXXXXXXX", "password":"XXXXXXXXX" }' -X POST https://INSTANCE/rest/auth/1/session 

 

2) You can then use that to authenticate the successive REST calls:

curl -b cookie.txt --header "X-Atlassian-Token: no-check" -H "Content-Type: application/json" -X GET https://INSTANCE/rest/........

OR

curl --cookie cookie.txt --header "X-Atlassian-Token: no-check" -H "Content-Type: application/json" -X GET https://INSTANCE/rest/........ 

 

Cheers,
Dario

Thanks  Dario .I will try that .

I got JSESSIONID on using it on our jira server and works fine . This one i will try on my test jira cloud!

 

@Dario Bonotto  one quick question  - i will not be able to use basic auth if log in and consequesnt request happening on different pages . Is my understanding correct ?  As there is no session in basic auth !

With basic auth you authenticate each request. So each request has its own session and this can impact your JIRA performances.

If you need to send multiple requests it is much better to use cookie authentication in order to avoid DoS-sing your JIRA instance :) 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,714 views 17 21
Read article

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