Forums

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

Check whether the user has valid Jira rest API credentials

Sumaia Kablan February 13, 2022

Hello

I am using jira-client npm, I want before doing any actual calls (creating tickets, find issues , ... ) to check whether the user has valid credentials for making API calls (for example maybe the token has expired or the credentials are incorrect).

Is there a separate call to check if the credentials are valid?, if not then I will inform the user that they need to provide valid once,  else I will let them do what they want to do. 

I am not talking necessary about jira-client node module .. I am talking in general (for example by using node fetch  module which allows me to do normal fetch methods).

I know that if the credentials are incorrect I will get a message for that, but I want to check that in a special call.

1 answer

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
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.
February 13, 2022

No, there's no separate call to check credentials.  Just try logging in with them.

Sumaia Kablan February 14, 2022

you mean by try to logging with them:

Nic Brough -Adaptavist-
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.
February 14, 2022

Yes

Like Sumaia Kablan likes this
Sumaia Kablan February 14, 2022

so in jira-client node module this is not possible I think .. since there is no method for such a call

Nic Brough -Adaptavist-
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.
February 14, 2022

No, sorry, I think I have explained it very badly. 

In order to check credentials, you simply try to use them.  If they're good, you'll get a response, if they're not, you'll get an error telling you the credentials are invalid.

The most simple one I've seen for a REST test of an account is a short script that just tried to ask for some known information like a single issue that is always there or the list of boards etc.

Like Sumaia Kablan likes this
Sumaia Kablan February 14, 2022

Thanx ..
I decided to go asking for project information (it is findproject in the node module with I am using) , in this way I can check two cases ..if the credentials are valid .. and if the user is authorized to the project

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events