Auth problems trying to add Jira gadget to Confluence page

We are trying to make our gadget work within the confluence page. We’re having problems with authorization when trying to do this.

The requests we send from the template section in the gadget.xml file receive response from our application without any problems.

var gadget = AJS.Gadget({
    baseUrl: "__ATLASSIAN_BASE_URL__",
    useOauth: "/rest/gadget/1.0/currentUser",
    ...
    view: {
        template: function(args) {
            const gadget = this;

            gadget.showLoading();

            gadget.getView().html(args.htmlTable);

            gadget.hideLoading();
        },
        args: [{
            key: "htmlTable",
            ajaxOptions: function () {
                return {
                    url: "/plugins/servlet/app/gadget",
                    type: "GET",
                    contentType: "application/x-www-form-urlencoded;charset=UTF-8",
                    dataType: "html",
                    data:  {
                        *** all data here are related the our app needs. no extra ***
                    }
                };
            }
        }]
    },
    ...
});

The response to this request comes as an HMTL and is written to the htmlTable variable. So far everything is as it should be. However, there is a script that makes an Ajax call in the htmlTable variable. When I render this HTML with gadget.getView().html(args.htmlTable), Ajax call executing and returns some 403-401 as response;

Here is the all text in oauthErrorText attribute

invalid parameter name [object Object], applications may not override opensocial or oauth parameters

==== Original request:
POST /rest/***/***/***/***/list

Host: localhost:8080
X-Shindig-AuthType: oauth
Accept: application/json, text/javascript,*/*;q=0.01
Content-Type: application/x-www-form-urlencoded
X-Atlassian-Token: no-check
X-Seraph-Trusted-App-Cert: mI06pkZ4BZ/....
X-Seraph-Trusted-App-ID: confluence:14294970
X-Seraph-Trusted-App-Key: cDJwFZ+xJ5LkuDqMcNGa5tVB....
X-Seraph-Trusted-App-Magic: ZUOmKFF5tFoQPM1hU093hrBT....
X-Seraph-Trusted-App-Signature: HiU+7EOb8WDTIgHcEX/Iny.....
X-Seraph-Trusted-App-Version: 2
X-shindig-dos: on

[object Object]
====

My Jira and Confluence apps seem to be connected to each other with OAUTH through the Application Links page without any problems.

What am I missing?

Thanks for the replies.

Ömer.

tags
applications may not override opensocial or oauth parameters
Client must be authenticated to access this resource.
gadget authentication problems