We are developing an app using Forge to enhance the capabilities of the “Help Center.” One of our objectives is to simplify the approval response process. Our goal is to allow unlicensed users to answer to approvals. To enable this, we transitioned from using the asUser()
call to employing asApp()
on our API calls. This adjustment successfully permits unlicensed users to carry out actions.
However, we’re unsure how to transmit the identity of the user who is responding to the approval to the specific endpoint responsible for handling it.
const approvalUrl = route`/rest/servicedeskapi/request/${issueKey}/approval/${approvalId}`;
const response = await api.asApp().requestJira(approvalUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify(body)
});
console.log("Response: ", response.json());
When the users triggers the function, we get the following error: “Client must be authenticated to access this resource”. If we change asApp() to asUser(), this is the error that we get: “Client must be authenticated to access this resource.”
We would greatly appreciate any assistance in resolving this issue.