how to impersonate as user

Sree Divya Bonagiri January 25, 2018

I would like to impersonate as user and retrieve few details like createmeta using rest api in Jira server.

In cloud, we have jwt oauth bearer token to achieve this. Is there any way to achieve this in Jira server?

2 answers

0 votes
Andreas Stenius May 4, 2018

Edit 2: Sorry for the confusion/noise. Never mind my comments. As it turned out, my access rights to our Jira instance had changed, so I was "just" admin, not system admin, and as such, did no longer see the 2-legged impersonation options in the incoming oauth settings.

 

Up until recently, we setup a normal "Generic Application" oauth link, and then sent a "user_id=..." parameter along with the API requests to do impersonation.

This worked fine on a vanilla Jira Server installation. (as of last year.)

But it seems like it doesn't work for new oauth tokens any more. Might be due to an update in the AppLinks system plugin perhaps?

I haven't been able to find any documentation regarding this, though.

@Andy Heinzer do you have any insights?

Edit: Checked last upgrade log, and we upgraded to 7.5.0 last october, so it may be since then that the user_id thing doesn't work on new oauth tokens.

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 26, 2018

There exists a feature request to allow for this in Jira server REST API in https://jira.atlassian.com/browse/JRASERVER-40913

But that issue was closed in order to be tracked over in https://ecosystem.atlassian.net/browse/AC-1080

While that issue has been resolved, it looks like this implementation was only created for the Atlassian Connect framework, which is only provided at this time to our Cloud offerings.

That said, I am aware of a pair of Jira Server plugins that will allow you to impersonate other users in Jira, provided you are the Jira administrator:

I realize these may not be exactly what you are looking for since these effect what is seen in the web interface versus a REST API call.  However my thought was that you might be able to use one of those plugins in conjunction with the Atlassian REST API Browser plugin.  At least that way you might be able to make a rest call as that user, granted it would have to be in the browser session in order to do this, but it could work.  I am not sure if this is really what you are looking for though, I could see if you were looking to automate this REST call for one reason or another this path might not be a viable solution.

Suggest an answer

Log in or Sign up to answer