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?

0

There are 0 answers