jira-cli: jira init - 401 Unauthorized

Describe the bug

jira init failing with 401 Unauthorized response. but worked with curl requests using the same API token.

image

Please provide following details

  1. JiraCLI Version:
    (Version="v1.1.1-0.20220814163226-d993757c939c", GitCommit="", CommitDate="", GoVersion="go1.19", Compiler="gc", Platform="linux/amd64")
    
  2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
    Cloud
    
  3. What operating system are you using? Also mention version.
    Void Linux
    
  4. What terminal are you using? Also mention version.
    foot
    

To Reproduce

Steps to reproduce the behavior:

  1. jira init

Expected behavior

should create config file. Screenshots

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (6 by maintainers)

Most upvoted comments

great. finally this worked for me. thanks @ankitpokhrel

JIRA_API_TOKEN=<token>  JIRA_AUTH_TYPE=basic jira init --debug

I can confirm this issue on Ubuntu 20.04, supplying the api token inline works; but setting the token via export or bashrc does not.

Hey @akhiljalagam and @viditsi1 ! I had a similar problem but I found out that I made mistake while setting environmental variable. I tried first to add just JIRA_API_ROKEN="xxxxxxxxxxxxxxxxxxxxx" to my .bashrc. My --debug init gave similar result than yours. Then after 2 min Google I understood to add command export to the beginning of line. After that I ran command source .bashrc, and voilá, it’s working! So make sure that your .bashrc file has a line like export JIRA_API_ROKEN="xxxxxxxxxxxxxxxxxxxxx". and then run command source .bashrc . I hope it will work! 😃

Thanks. But I always use export in my env files. @jaervei

Hey @akhiljalagam and @viditsi1 ! I had a similar problem but I found out that I made mistake while setting environmental variable. I tried first to add just JIRA_API_ROKEN="xxxxxxxxxxxxxxxxxxxxx" to my .bashrc. My --debug init gave similar result than yours. Then after 2 min Google I understood to add command export to the beginning of line. After that I ran command source .bashrc, and voilá, it’s working! So make sure that your .bashrc file has a line like export JIRA_API_ROKEN="xxxxxxxxxxxxxxxxxxxxx". and then run command source .bashrc . I hope it will work! 😃