Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Basic Authentication Failure - Reason : AUTHENTICATED_FAILED

Prashant I'm New Here May 04, 2022

from jira import JIRA

JiraUserId = ''
JiraApiKey = 'XMDNBQ456CFGHTY'
JiraEmailId = ''
JiraServer = ''
JiraIssueKey = 'ZDFGH-4567"'

options = {'server': JiraServer}
jira = JIRA(options, basic_auth=(JiraUserId, JiraApiKey))
issue = jira.issue(JiraIssueKey)
summary = issue.fields.summary
print('ticket: ', JiraIssueKey, summary)


Unauthorized (401)

However, I am able to login manually to Jira. What is wrong with my code? Can someone please guide me?

1 answer

Looks like a problem with your authorization header. Had the same error thrown at me today by testing REST endpoint with curl. I tried using a PAT instead and the error went away. Then I tried changing how I pass login and pass to curl and it worked. I noticed that for some reason base64 in the header curl generated was different from the one I provided it earlier. (edit: just found out that I accidentally added a newline to my credentials before converting them to base64) So maybe your python module does something with authorization in a way that Jira doesn't like.

Another possibility is that your Jira server has basic auth for REST disabled although that's kind of a long shot.

Suggest an answer

Log in or Sign up to answer

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