Forums

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

How can i connect to Jira API with two clients in an intelligent way ?

Lina Radi
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!
July 9, 2020

Currently i have a user who has permissions on some projets , i use createWithBasicHttpAuthentication to connect it to the JIRA API , and i do have another user who has permissions on other projects , i need to get all the projects, but i can't find an intelligent way to connect both users in one call (or method) , does_it exist something like that ? Thanks

1 answer

1 accepted

0 votes
Answer accepted
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2020

Hi Lina, welcome to the Community!

First I just want to double-check that API tokens are being used for both users. Details about how to use these with Atlassian Cloud are listed here. In short, you generate a new token from id.atlassian.com and use that in place of a password. The advantage to this is that you can have multiple tokens on your account (one per application) and they can be easily revoked!

Next, I'd approach the question from the perspective of security. If you are trying to authorize a script to connect as two different users, is there a particular reason for doing so? Could one user have permission on all the projects you need; either by adding permissions on one of two user accounts you already have, or perhaps just using a third account that has the appropriate permissions?

If two separate accounts must be used for some reason, I would suggest just using two calls in your script. You could write a method to connect and get details that accepts a username/API token as parameters, and pass whichever user you need at the particular time you need it. That way you only write one method, but you get flexibility in which user account is making the call. You'll have to work with the results twice, but it should be possible to structure a script around that.

Cheers,
Daniel

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events