Can I use user impersonation from the Javascript API? [Or alternative approach if available]

Hello everybody,

Here’s our use case and the limitations we’re facing:

We want to build an integration to Jira Cloud (Atlassian Connect) for one of our products. It will basically be a way to sync and update tasks between the two tools. We have the following two post-installation requirements:

  1. select and send towards our product a list of Jira projects to sync with.
  2. select and send us two pre-created custom screen tab fields to be mapped to two of our internal fields (.e.g “Expected completion date”).

One more limitation is that we would rather not direct the Jira Admins to log into our product and do the process from there because they will probably not have credentials or even know what our product is about.

For requirement 1. this were pretty easy. I managed to write a PoC configuration page module that reads the available projects using the JS Jira Api (the request feature) and sends them to our endpoints. We can easily build logic on top of that to extend this functionality and allow the admins to do some mappings to our internals.

Unfortunately for 2. the required scope for our Connect add-on to read the screen tab fields is ADMIN which not something we would like to request. Thus we cannot execute calls towards that Rest API endpoint even if the logged-in user is a Jira Admin.

From what I understood from the documentation, we could use user impersonation to do Rest API calls if the code was running on our side. My question then is if we could use the same mechanism from within a Page Module by utilising the JS API.

Alternatively, is there something I’ve got wrong in the whole process and if so is there a different approach we could take?

I hope that I’ve described our situation clear enough but in any case I’m happy to clarify any point or answer any question.

Thank you very much in advance for your help.

Kind regards,