"Current user not permitted to use Confluence" with OAuth user impersonation on some instances

We are trying to create a workaround for a bug in a workaround for a bug in a workaround for a bug for this 3½-year old issue: https://jira.atlassian.com/browse/CONFCLOUD-60235
But we are hitting a bug in our workaround for the bug in the workaround for the bug in the workaround for the bug and can’t seem to find a workaround for the bug in our workaround for the bug in the workaround for the bug in the workaround for the bug.

Our app is showing page content using the body.export_view expansion. There is a bug that single-issue Jira macros are not rendered properly, and they don’t contain any other information than the issue key.

As a workaround, we are trying to manually fetch the issue information and display it in a similar way as it would be on a regular Confluence page. To imitate the behaviour of the Confluence Jira macro, we call the /rest/jiraanywhere/1.0/jira/clientIds/ REST endpoint with the SINGLE_<Jira server ID>_<page ID>_<user ID> request using AP.request() to fetch the details about the issue. Unfortunately, as opposed to the view rendering, the export_view rendering of the Jira macro does not contain the Jira server ID.

As a workaround, we try to fetch the list of all configured Jira servers using the /rest/jiraanywhere/1.0/servers REST endpoint. Unfortunately, this request is not possible through AP.request and gives us a Request not in an authorized API scope error.

As a workaround, we implemented a proxy service in our backend that accesses that REST endpoint using OAuth user impersonation. This has been working fine so far, but now we have discovered that it doesn’t work on all instances. We have identified one instance (running the Free Plan) where this request fails with an error Current user not permitted to use Confluence. Accessing the REST endpoint manually in the browser works fine, it’s just that it doesn’t seem to work through OAuth.

This is where my Working Around Atlassian Bugs skills have reached their limits. Does anyone have a clue for a better workaround for one of the stages?

4 Likes