I’m having trouble with using the AP.request method in the Javascript client.
I have created a Plugin which shows a custom page (general page) inside Jira.
From this page, I want to create a Confluence content page via the AP.request method of the Javascript client.
Working with the JIRA API via AP.request works fine, but when I try to call any method of the Confluence API it always fails with 403, no matter the endpoint I’m using.
There are specific scopes necessary to invoke specific endpoints. Check this page which defines which scope is necessary for specific REST methods of an endpoint. Since you’re using PUT for /rest/api/content you would be needing a WRITE scope.
As for the URL, I believe you should drop /wiki and start with /rest.
Maybe the scope only for jira.
The JWT/auth used in AP.request only for you to call the Jira REST only.
You don’t have permission to call Confluence REST
I tried your code and get the same error. HTTP Status 403 - The add-on is not installed
I missed the part wherein it states that it should be accessed inside a JIRA add-on, my bad. Sad to say, this existing issue says that
AP.request() does not allow the targeting of requests to other products for the same customer.
and I’m not sure of any existing workarounds using JWT.
One possible route to take is to create two different add-ons that can/will access the same add-on DB. Then work out a way to note that the owner of the Confluence and JIRA instances are the same (yourinstance.atlassian.net and yourinstance.atlassian.net/wiki) which can be usually achieved by generating a token on one (JIRA) and add to the configuration of the other (Confluence). I have not personally tried this route but it looks plausible, on paper at least.
could you please clarify your route?
I have 2 plugins (wiki & jira) on 1 base
on install I iterate over all records to find clientKey & sharedSecret and store them
now I can create jwt.
But it is useless, I can access only another plugin using jwt (if origin added to ALLOW_ORIGIN, but I can acess it in more simple way)
I can not access neither Jira no Confluence:
Failed to load https://domain.atlassian.net/rest/api/2/field:
No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Origin ‘https://3681aa86.ngrok.io’ is therefore not allowed access.
the reason is we are in iframe
the only possibility is go to another plugin backend, do requests and response, but it seems too long
so could you please clarify possible route step by step.
After further reading, I stumbled upon this cross-product add-ons issue and I’m afraid my previous suggestion, which I think was plausible, wasn’t really.
I’m having this 403 issue when trying to implement an admin page module for my Confluence connect app. The scope contains “READ”, “WRITE”, “ADMIN”.
When trying to do a post request with AP.request from the admin page, I get a 403.
However when I do a post request with AP.request at the Confluence page where I added my macro, it works.