I'm trying to authenticate with the JIRA REST API in Python. Using Jira Cloud.
I generated a Jira API token.
Using the jira Python package, I tried:
jira = JIRA(JIRA_URL, auth=(username, token))
issue = jira.issue("CM-877")
and got "Login failed". I verified that 'username' and 'token' have the proper values.
I then tried something from the command line:
curl -D- -X GET -u mylogin@mydomain.com:TOKEN_VALUE -H "Content-Type: application/json" https://mydomain.atlassian.net/rest/api/issue/[issue name]
and I got "Basic authentication with passwords is deprecated".
I'm trying to follow the example at: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/
Does someone have code that works?
Can you try generating the base64 encode of your credentials and try this?
curl -D- -X GET -H "Authorization: Basic <your base64 code>" -H "Content-Type: application/json" "https://mydomain.atlassian.net/rest/api/2/issue/[issue name]"
Replace '<your base64 code>' with the base64 string.
You can generate the base64 string online like at https://base64.guru/converter or https://www.base64encode.net/
You have to provide your credentials like 'mylogin@mydomain.com:password'.
Hope this helps.
Thanks,
Vamsi
You stated you're developing for Jira Cloud, but linked the API documentation for Jira Server's REST API.
https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/
https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/
Then do as Vamsi suggested and include Base64 encoding.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.