Connecting OnlyOffice API client with nextcloud

Hi,

We have nextcloud as our storage installed on :8080 and OnlyOffice on :9000 , as our frontend we are using Angular, I am displaying files, creating, updating with Webdav, what is the configuration i need to set up to be able to display and edit files in OnlyCloud client ? when i pass it Url of the file it just says unable to download.

Thanks

Hello,

If you are developing your own integration with ONLYOFFICE editors, please take a look at How it works section of our API:
https://api.onlyoffice.com/editors/howitworks

Please make sure the file is downloadable at the given link. Send me the log file /var/log/onlyoffice/documentserver/converter/out.log after reproducing the issue.

Hi,

this is the log after trying to open the file, im using webdav to generate a link to the file in nextcloud, if i console log the link and open it, it works, but trying to open it in onlyoffice client doesnt.

Hello,

Your file is not publicly available so the Document Server cannot download it. You have to solve this issue on the side of your WebDAV storage.

Hello,

Thanks for the anwser, but if i make it publicly availabe then its a security issue or ? By opening it with the browser it works becouse i am already signed in to nextcloud so it can download, but is there a way that i can send a token in to the onlyoffice client so it works?

Thanks

For the integration to work, the Document Server must be able to download a file from the storage. Document Server must have an anonymous access to the storage. If your file can only be downloaded after logging in to your storage, document editing will not be possible because there is no way for the Document Server to download such file.

Hey,

And how can i set this up with nextcloud? Have a user that can see all the folders of all the other users? So basicaly everytime somebody uploads a file, creates a folder, i need to share it with that user?

You can install our connector for Nextcloud and analyze how it provides files to the Document Server. The source code is open:

Hi again,

I have checked out the source code and it seems that it uses some internal functions in php that i can’t really access trough my frontend, what about the token property in the onlyoffice client ? maybe i can use that to validate my user and download the file?

Hello,
You can enable JWT to sign the editor config with a token, this way you will prevent anyone from changing it. But the document URL is not signed, it must still be possible for the Document Server to download it anonymously.

Hi,

So i have analyzed the code, and found out that i can call different routes in routes.php,
so to get the anonymous download link i need to call :8080/apps/onlyoffice/ajax/url
but when i do i get access forbidden, maybe u know what else i need to pass to get authorized to call routes?

Thank you so much.

More specifically it says: “CSRF check failed”

Could you please describe the scenario in more details?

Hi,

Well u said i should analyze the connector to see how it provides the files to the document server, i have done that and (at least i think so) for it go the an anonymous url, it calls the method getUrl() inside editorcontroller.php , then i found out that this method is exposed it the routes.php file, so by calling the end-point myserver:8080/apps/onlyoffice/ajax/url , i coud call that function and get the result. But when i call that end point it just return error message:
“CSRF check failed”

Thanks