Integrating ONLYOFFICE Document Server for Local Document Editing in an offline Web Applications

Document Server version: 8.0.1-31
Type of installation: deb/rpm
Installation guide: https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx
OS: Ubuntu 22.04.4 LTS
Browser version: Mozilla Firefox 127.0

Hello everyone! I’m new to this community and exploring the possibilities of using onlyoffice-documentserver as an editor in my offline web application (in a small network of 5 users) with locally stored documents. I have successfully implemented the example provided in the documentation, and it works well.

My question is, what steps should I follow to integrate it into my web application for opening and editing ? Specifically, what changes do I need to make to the “CallbackUrl” and the link to “api.js”? to use them locally
(-.
-“callbackUrl”: Callback handler - ONLYOFFICE Api Documentation)

also, the generation of token for every documents to avoid: “The document security token is not correctly formed. Please contact your Document Server administrator”

Thank you for your assistance!
the example that i have tried it is in the screenshot :

Hello @Badis

First of all, please note that newer version of ONLYOFFICE Docs (Document Server) is available, I’d recommend updating it.

As for the integration: you should start from getting better understanding of how Document Server works by checking out Basic concepts and How it works sections of our API.

Additionally, you can download and install test example to preliminary integrate your Document Server with it to check out all aspects of integration that you can use for further integration with your own storage application:

If you are planning to use Document Server in local network, you need to make sure that Document Server can access files of your storage too.


As for the Callback Handler: please take a look at the documentation about it to find out more:

JWT is enabled by default which means that you are, as independent integration, must provide valid token to Document Server when opening a file. You can also check out how this is implemented in test example for your reference. Additionally, you can also find information about it in our API:

If you do not want to use JWT in your integration, you can disable it, please see how to in this article from our Help Center:

Thank you very much for your assistance. I really appreciate your help. However, there is one point I would like to clarify. Since I am using OnlyOffice in an offline network, I am unable to use the callbackUrl as it requires an online connection. Do I need to rewrite my own callback handler in this scenario?

Thank you once again for your support.

Yes, as an independent integrator you will have to utilize your own Callback Handler. By the way, there are save examples for it available in API:

Thank you for your continued assistance with my inquiries.

I have encountered an issue upon changing the API link to the local one (src="http://172.17.0.1/web-apps/apps/api/documents/api.js"). Specifically, when attempting to access a local DOCX file :
“document”: {
“fileType”: “docx”,
“key”: “Khirz6zTPdfd7”,
“title”: “1.docx”,
“url”: “http://172.17.0.1:8080/project/documents/1.docx
},
I receive the error message: “The document security token is not correctly formed.” in the case that i set token.browser to false in local.json. i have the error : “Download failed”

Hello, after doing this, I get the following error. Can you help me on the issue?

The document could not be saved. Please check the connection settings or contact your administrator. When you click the OK button, you will be prompted to download the document.

Sorry for the late reply.

This is surely related to the token. Did you change all three values * token.enable.browser, token.enable.request.inbox and token.enable.request.outbox to false and then restart Document Server services? Command to restart services is systemctl restart ds-*.


Hello @fkeles

This is different issue, please create separate post with detailed information about the issue to avoid mixing up topics. Make sure to provide at least following information in new post:

  • version of Document Server;
  • type of installation of Document Server;
  • logs of Document Server after reproducing the issue.

Logs are located in /var/log/onlyoffice/documentserver for DEB/RPM packages installation and the same path for Docker but inside container with Document Server.

Thank you for understanding.

Hello,
8.0.1
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION=“Ubuntu 22.04.4 LTS”

Ekran Alıntısı

@fkeles, please create new separate post from this one so that it’d be easier to focus on one user at a time. Thank you.