danshumaker / jira-cli

A Jira Command Line Interface
MIT License
69 stars 23 forks source link

Basic auth with passwords is deprecated #46

Open tandrewnichols opened 3 years ago

tandrewnichols commented 3 years ago

I was really excited when I found this lib, but after running jira config and entering my credentials, I was getting "No issues" when running jira ls. Added some logging and found that a 401 is being returned with the message Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html. Following that link, it says that change was June of 2019, although there is development and (unrelated) issues opened here since then, which makes me think it's been working for people. I tried swapping my password with an API token just to see if that would work, but it did not.

danshumaker commented 3 years ago

Hi @tandrewnichols , we definitely use the API token for jira authentication and not passwords. And yes it still works. At one time we did use passwords, but in the config file you should see something like this:

config-example

tandrewnichols commented 3 years ago

Hmm, I guess I need to try it again.

cruinh commented 3 years ago

I'm having basically the same issue. My config file has the right url, user and I can see a token there, but jira ls returns "No issues".

I haven't tried adding logging, per se, but using the -v flag, I was able to see get the URL jira-cli is using when I run jira ls. If I copy and paste that URL into my browser, where I'm already signed in to JIRA, the URL returns results, but jira ls doesn't. I was kinda assuming SSO is to blame, since my company has that set up on our JIRA account. Does jira-cli support having SSO enabled on the Atlassian account?

[update] ... I managed to get things working for me. I ultimately had to follow this document to create an API Token. Then I ran jira config, used my email as the username and my token as the password.

shorttompkins commented 3 years ago

Im having the same issue - ive created the API token, updated my jira-cli/config.json to ensure that my url, user, and token are correct, and just cant get jira ls to work locally - but pasting the url into a browser works (since Im signed in via SSO already in Chrome). Ive tried replicating the request that the cli does by pasting the url into Postman and including an Authorization: Basic ### header and thats when I get the same url about passwords being deprecated that was originally posted in this Issue.

edit: OK I actually figured out what the problem was: the API token that Atlassian generates isn't enough alone, you need to actually base64encode your emailaddress:token and enter that into your ./jira-cli/config.json like their docs show here: curl --user me@example.com:my-api-token. After I replaced my token value in my config with this new encoded value jira ls works ;)

martinsantibanez commented 3 years ago

The solution for me was to go to https://id.atlassian.com/manage-profile/security/api-tokens, generate a token and paste it in config.json / auth.token