ONLYOFFICE Workspace 12.5: enhanced security, optimized document management, Dark theme, and more
ONLYOFFICE Workspace 12.5 released

How to insert content control where the Url of the file is an authenticated api endpoint

Document Server version:
Installation method: Server Edition
OS: MacOS version 12.6 (Monterrey)
Browser version: 108.0.5359.124 (Official Build) (arm64)


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

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();
                                  "InsertAndReplaceContentControls", [documentListCommands]);

Hello @mmetterle
Please note that Document server should have the opportunity to download a file. Document server is just an editor in fact, it can’t use authentication methods. As independent integrator, you can manage and store your files in your own way, but you have to make sure that Document server is able to get those files.
Sorry, but both described scenarios are not possible.
One more thing, you mentioned commercial license. If you have commercial license, it’s better contact us via Zendesk to get prompt replies.