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
Hi Phani,
From the screenshot that you have provided, you have created an admin API key - API 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.