It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Getting session cookie from jira cloud /rest/auth/1/session does not work

I am trying to get a session cookie from:

POST

https://xxx.atlassian.net/rest/auth/1/session

{"username":"aaaa","password":"bbbb"}

 

I am pretty sure that the provided credentials are correct - I can login with them in the web interface. However the call made with Postman always returns:

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

There is no response header that would give any more information why it fails.

 

What could be the reason? I was thinking that maybe it is catpcha, but I cannot check that, as I always get redirected to https://id.atlassian.com  when I try to access the Jira login page directly.

 

 

2 answers

0 votes
DPK J Community Leader Oct 16, 2019

@M KCookie based authentication has been deprecated and removed for Jira cloud in favor of token based basic authentication.

You can learn more from this notification which is more then 6 months old - https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/

Thank you for the information. I understand that token based authentication only applies to Jira cloud. Is there a way to implement authentication in javascript that would work for both Jira cloud and Jira server?

Cookie based authentication did work well for both server types.

DPK J Community Leader Oct 17, 2019

@M KI made a small script in NodeJS for copying attachment from Server to Cloud (and vice versa), and I used BasicAuth for both. The only difference is in server/dc environment you have to use 'username' and 'password' combo whereas in cloud you have to use 'email' and 'api token' combo, when I made a UI for this, in form I mentioned this for users.

So I think BasicAuth is good enough for these kind of use cases.

Thank you. In the older server versions I am using a call to /session to get a session cookie. I guess I will have to change that to basic auth.

When calling jira server with username / password, do you encode the string to base64 like when calling jira Cloud?

DPK J Community Leader Oct 18, 2019

Yes, BASE64 encoding is required for server version also.

You can refer this - https://developer.atlassian.com/server/jira/platform/basic-authentication/

I would like to ask you for a small favour. Since I do not have access to a Jira Server, would you be so kind to test if my script works with Jira Server too? It can be installed in Chrome / Opera / Firefox from: https://www.novibyte.com/

I think you might like it.

DPK J Community Leader Oct 18, 2019

I can try it on Monday on test instance.

DPK,

 

If you try the iPlugin script, you can best use Chrome; the webstore now publishes the latest version 5.0. It can be installed here:  https://www.novibyte.com/

 

I could test it on Jira Cloud. It would be great to hear if it also works on Jira Server.

 

Best,

MPK

DPK J Community Leader Oct 21, 2019

@M KTwo issues so far,

1. Window is too much transparent, and if you site is blue it become difficult to read text in plugin dialog.

Screenshot 2019-10-22 at 10.29.50 AM.png

2. When I entered site details, and pressed `LOGIN` button, nothing happen. Neither there was indicator of processing nor any action happen even after 2-3 minutes. I have triple checked credentials I was using. Also there was not network request, so it seems like some JS issue.

 

I hope this help.

That is strange indeed. The calls to Jira are made by the background page. You can open it by extensions > iPlugin > background page. It should show why the call fails. 

 

Also, if you could provide me with a test account on some Jira server accessible from outside, I could test it myself. If that is not possible, I understand.

 

PS If you try the same with Jira Cloud it should work fine with emai / API Token login.

DPK J Community Leader Oct 22, 2019

Marek,

You can this site one company has hosted for demo of Requirement Management tool called RMsis, there product (make sure you don't use at large scale).

Credentials are,

Site - https://jira-rmsis.optimizory.com

Username - pm1

Password - project123

 

Hopefully this resolves your issue.

That would be great, I thank you in advance. May I ask your name? My name is Marek.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

365 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you