I try to authenticate to the Jira REST API with a token, but I get an error that
Basic authentication with passwords is deprecated
How do I tell the Jira API that I'm using Basic authentication with a token, not a password?
(venv) $ cat error_demo.py
import base64
import json
import requests
jira_user = 'me@myorg.com'
jira_token = '9rXXXXXXXXXX5B'
cred = "Basic " + base64.b64encode(b"jira_user:jira_token").decode("utf-8")
print("cred =", cred)
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization" : cred
}
projectKey = "NETOP-1987"
url = "https://myorg.atlassian.net/rest/api/3/search?jql=key=" + projectKey
response = requests.request("GET", url, headers=headers)
print("response =", response)
print("response.text =", response.text)
(venv) $ python error_demo.py
cred = Basic amYYYYYYYYYYYYYYW4=
response = <Response [401]>
response.text = Basic authentication with passwords is deprecated. For more information, see: https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/