Document Server version: 7.1.1.23
Installation method: Server Edition
OS: MacOS version 12.6 (Monterrey)
Browser version: 108.0.5359.124 (Official Build) (arm64)
Hello,
I have written a custom plugin which will download a remote file and allow the insertion of a content control into the target document with the content from the downloaded document. I actually used the example from https://github.com/ONLYOFFICE/sdkjs-plugins/tree/master/example_insert_content_and_document.
This currently works when trying to access a word document that is publicly accessible or shareable. However, if I try to pass in a url to an api endpoint, which requires an authenticated user, to download the same word document file, I receive a 401 authorized in the onlyoffice server logs. This is a GET request that downloads the same file in my browser with no issues.
My question to you, is it possible to invoke the InsertAndReplaceContentControls with a URL that requires an authenticated user in order to download the file content and insert this into the target document? If not, is this possible using any other plugin api method or document builder script from the only office plugin?
Besides the fact that the endpoint requires a token for user authentication (i.e. inserted as a cookie), the file is stored in our s3 repository, so it would need the proper credentials to use S3 in order to access the file. I have also included the relevant screenprint of the error and process, but couldn’t find anything else beyond that for debugging purposes.
NOTE: We currently pay for onlyoffice and we are trying to integrate this into our application for a new customer.
function getDocumentListCommands() {
var documentListCommands = [
{
Props : {
Id : 0,
Tag : "example",
Lock : 3
},
Url : "http://example-api-endpoint",
Format : 'docx'
}
];
return documentListCommands;
}
window.Asc.plugin.init = function()
{
var documentListCommands = getDocumentListCommands();
window.Asc.plugin.executeMethod(
"InsertAndReplaceContentControls", [documentListCommands]);
}