Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Authentication with Jira CLI and a token instead of a password?

Andy Wegner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 11, 2018

I am attempting to piece together how I can use the JIRA CLI with an API token instead of a password.

The example provided in the documentation is this

java -jar `dirname $0`/lib/jira-cli-7.8.0.jar --server https://my.example.com --user automation --password "automation" "$@

 I've attempted to modify it to match curl examples provided [here](https://community.atlassian.com/t5/Jira-questions/How-do-I-get-an-authorization-API/qaq-p/818421) and on the API tokens documentation ([here](https://confluence.atlassian.com/cloud/api-tokens-938839638.html))

java -jar `dirname $0`/lib/jira-cli-7.8.0.jar --server https://my.example.com --user me@example.com:myprovidedtoken "$@

However, this doesn't work. When I run

./jira.sh --action getServerInfo --outputFormat 2

I get:

This function requires a non-blank value for parameter password.

Moving the token to the password parameter doesn't work either:

java -jar `dirname $0`/lib/jira-cli-7.8.0.jar --server https://my.example.com --user me@example.com --password "myprovidedtoken" "$@

 Then rerunning:

./jira.sh --action getServerInfo --outputFormat 2

Remote error: User is not authorized to perform the request. Response code: 401.

I am an admin and should have fun access.

Question: How do I properly pass an API token to the jira CLI?

Bonus, in case I missed a permission: How do I grant a user access to utilize the API?

2 answers

1 accepted

0 votes
Answer accepted
Prakhar Srivastav {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 11, 2018

@Andy Wegner

 

Can you please confirm your CLI version? The support for Access Token is available from CLI 7.7 . See the last comment on the ticket :

https://bobswift.atlassian.net/browse/ACLI-191

If your version is correct then you should be able to provide token in the password value.

Below is the documentation for this :

https://bobswift.atlassian.net/wiki/spaces/ACLI/pages/392757809/Authentication

 

Regards

Prakhar

Andy Wegner
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 12, 2018

Hi @Prakhar Srivastav {Appfire}, I had been using CLI7.8, but moved to the snapshot 7.9 this morning. That seems to be working.

Prakhar Srivastav {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2018

Hi @Andy Wegner

It should work with CLI 7.8 also. If it is not , can you please raise a bug here .

https://bobswift.atlassian.net

 

Regards

Prakhar

0 votes
Girish February 13, 2020

Any solution for this?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events