Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I call JIRA as the user with Atlassian Connect Express?

Konrad Garus
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.
November 9, 2015

Hello,

I'm building an add-on with Atlassian Connect Express. When JIRA calls my addon, I would like it to make a call back as the currently logged in user. For example, call /rest/api/2/myself and get Jimmy's profile.

How can I achieve it?

When I make the call using the snippet below, it returns information about the addon.

app.get('/myproject', addon.authenticate(), function (req, res) {
    var httpClient = addon.httpClient(req);
    httpClient.get('/rest/api/2/myself', function() { /* */ });
});


Even if I include the "Authorization: "JWT <token>" header, it gets overridden with that of the plugin, so the call still returns the addon's "profile".

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Travis Smith
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.
November 9, 2015

This is not currently possible; there's an issue open, AC-1080, which you can vote, watch, and comment on. To act on the behalf of a user, it must happen in the user's browser session. 

Konrad Garus
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.
November 9, 2015

Thank you. I guess I could also use the request library (or another HTTP client) directly with the JWT token coming on the server request, correct?

Travis Smith
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.
November 10, 2015

Any JWT signed request would have the same behaviour, acting as the add-on user.

TAGS
AUG Leaders

Atlassian Community Events