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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

146 views 1 17
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