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

How do I login on jira python using google account? Edited

I am trying to access my hosted JIRA via python but I get a 401 error when I try to login.

My code:

from jira import JIRA
options = {'server': 'https://[instance_name].atlassian.net'}
jira = JIRA(options, basic_auth=(username, password))

Based on https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-work-with-jira-python-api-using-google-account/qaq-p/505609 the issue is connected to my login being managed by my google account and I should have access to an alternate password but I can't find it. The help page linked there does not exist anymore, so I am guessing that the instructions are out of date. Are there any more up to date instructions available?

1 answer

1 accepted

1 vote
Answer accepted
Andy Heinzer Atlassian Team Mar 01, 2019

I'm afraid the link you reference here is 5 years old and yes, it's out of date.

I'd recommend checking out Basic auth for REST APIs  It explains that for Jira Cloud today, if you want to use basic authentication, you're going to have to create and use an API token

Supplying basic auth headers

If you need to, you may construct and send basic auth headers yourself. To do this you need to perform the following steps:

  1. Generate an API token for Jira using your Atlassian Account: https://id.atlassian.com/manage/api-tokens.
  2. Build a string of the form useremail:api_token.
  3. BASE64 encode the string.
  4. 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:

I hope this helps.

Andy

That did help, but it was actually a few steps ahead of the correct answer!

For future googlers, the correct way is to use the API token as your password. So in the case of a username of fred@gmail.com and an API token of t0k3n you'd use the following:

 

from jira import JIRA
options = {'server': 'https://[instance_name].atlassian.net'}
jira = JIRA(options, basic_auth=('fred@gmail.com', 't0k3n '))

 

Like # people like this
sfavaro I'm New Here Sep 06, 2019

That works for Jira, but I cannot do the same for Confluence. Any idea?

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 ...

375 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