Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 to Authenticate Jira Rest APIs using Client ID and Client Secret Edited

Hi, 

I am trying to invoke REST API using Basic Authentication protocol. 

Initially, I used the combination of Email and API Token as suggested by the Cloud REST API documentation

url = "https://<jira-host>.atlassian.net/rest/api/3/issue/<issue-key>"


r = requests.get(url, auth=('username@useremail', 'api_token'),
headers={"Accept": "application/json"})

// Can be also called with HTTPBasicAuth
(auth = HTTPBasicAuth("username@useremail", "api_token"))

Now I would like to replicate this functionality using a Client ID and Client Secret, that I created using Admin API (Attached Image), using the same HTTP Basic Authentication protocol like above instead of OAuth 3LO but when I am using the same code as above, I am getting a 401 error. 

url = "https://<jira-host>.atlassian.net/rest/api/3/issue/<issue-key>"
auth = HTTPBasicAuth("client_id", "client_secret")

headers = {
"Accept": "application/json"
}

response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

Please let me know where I am going wrong.

 

Thanks in advance, 

Phani

Jira.png

1 answer

Hi Phani,

From the screenshot that you have provided, you have created an admin API keyAPI keys allow you to manage your organization via the admin APIs.

As for the Basic Auth for Atlassian Cloud platform - we no longer will be able to use this protocol for authentication; Deprecation notice - Basic authentication with passwords and cookie-based authentication

I hope that this helps.

Thanks,
Moga

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

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