Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Did anything change in the authorizationmethod recently?

projectoverview June 19, 2019

My jira rest API script stopped running recently (it is set to run every night). When i tried to run it manually i got an error in the following line of code:

# Basic Jira login information
jira = JIRA({'server': "https://xxxx.atlassian.net/"}, basic_auth=("xxxxx@xxxxx.com", "xxxxxx"))

I looked up if any changes were made to the authorization method  but i couldn't find anything. Can someone please help?

 

Best regards

Mussab

 

Edit: What is the equivalent of that line of code in the 'api token' authentication method?

I've tried:

jira = requests.get('https://xxxxx.atlassian.net/', auth=('User@name.com', 'API_TOKEN'))

 But I'm getting:

AttributeError: 'Response' object has no attribute 'projects'

in: 

projects = jira.projects()

 

2 answers

2 accepted

Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 25, 2019

OK, then it was indeed because the password was still used instead of the API Token.

Nice to know that this issue is now solved :) 

0 votes
Answer accepted
Dario B
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 20, 2019

Hello @projectoverview ,

As you already found out, basic authentication with password has been deprecated and replaced by basic authentication with API Tokens:

Now, the only difference here is that you are now supposed to use email address and api token to authenticate instead of email address and password. 

 

However, in case this is still not working for you, can you kindly try to authenticate a REST API request using curl (example below) or postman and paste the output in here (please remove any sensitive information):

curl -D- -u EMAIL-ADDRESS:API-TOKEN -X GET https://xxxxxxxx.atlassian.net/rest/api/2/project

 

Cheers,
Dario

projectoverview June 25, 2019

I used a curl-to-python converter and got the following:

"""

import requests

jira = requests.get('https://xxxxxxxx.atlassian.net/, auth=('EMAIL-ADDRESS', 'API-TOKEN'))

"""

I tried that and got:

Traceback (most recent call last):
File "C:/Users/xxxx/Desktop/xxxxx/REST_Jira.py", line 191, in <module>
(the line that failed): projects = jira.projects()
AttributeError: 'Response' object has no attribute 'projects'

projectoverview June 25, 2019

I used to use:

from jira import JIRA
jira = JIRA({'server': "https://xxxx.atlassian.net/"}, basic_auth=("xxxxx@xxxxx.com", "xxxxxx"))

And now I'm not making any use of :

from jira import JIRA

Suggest an answer

Log in or Sign up to answer