1

I'm using Atlassian-Connect-Express to create a Jira addon and encountered an issue where I get an error message: "Client must be authenticated to access this resource." when using the function asUserByAccountId.

app.put('/getJiraFieldData',  addon.checkValidToken(), async function (req, res) {
        const httpClient = addon.httpClient(req);

            const options = {
                url: '/rest/api/2/customField/XXXX/option', //XXXX is the field id, example: 10043
            };
               await httpClient.asUserByAccountId(req.context.userAccountId).get(options, 
                async function (err, res, body) {
                    if (err) {
                        console.error(err);
                    } else {
                     //some code here.. 
                    }

});

The thing is that every other request using httpClient.asUserByAccountId in the REST API document works and returns data. Only this specific request returns an authorisation error.

Am I missing something in the authorisation process?

tzach
  • 35
  • 3
  • Does the user have Administer Jira permission as stated in the REST API docs? https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-field-fieldKey-option-get – RedWolves Jan 02 '20 at 23:07

0 Answers0