Moodle
Watch video
How to integrate ONLYOFFICE with Moodle
Learn how to integrate ONLYOFFICE online editors with Moodle to easily create, edit and collaborate on text documents, spreadsheets, and presentations.About the ONLYOFFICE and Moodle integration
ONLYOFFICE offers an official connector to integrate ONLYOFFICE Docs with Moodle and edit office documents attached to the course pages. You can download the ONLYOFFICE connector from the Moodle plugin library or the GitHub page.
To learn more about how the ONLYOFFICE connector for Moodle works, please visit our API documentation.
Main features
-
Editing and viewing text documents, spreadsheets, presentations, and forms.
To learn more about forms, please read the corresponding articles for creating and filling out forms.
- Co-editing documents in real-time: two co-editing modes (Fast and Strict), the Track Changes mode, comments, and the built-in chat.
- JWT support to secure your traffic so that no one can have access to your documents with the exception of the users with proper rights.
Supported formats
- For viewing and editing: DOCX, XLSX, PPTX, DOCXF
- For viewing only: PDF, TXT, CSV
- For filling forms: OFORM
- For converting to Office Open XML formats: ODT, ODS, ODP, DOC, XLS, PPT, PPS, EPUB, RTF, HTML, HTM
What's new in versions 2.2.0 and 3.0.0
Added
- add protect option for editor
- add ability to open editor in fullscreen mode
- add mentions in comments in editor
- "save as" in editor
- add ability to create activity with empty file
- add favicon on editor page
- editor interface customization
- de, es, fr, it, ja, ru, zh_cn translations
- add support for ONLYOFFICE forms
Changed
- set editor interface language
- fixes building backup and restore
- redesign to Moodle 4
The full change log is available here.
Connecting ONLYOFFICE Docs to Moodle
Requirements
-
ONLYOFFICE Document Server v6.2 (server or cloud version) or later
You need an instance of ONLYOFFICE Docs that is resolvable and connectable both from Moodle and any end clients. It must be able to POST to Moodle directly.
Please refer to the official documentation page to learn more about installing ONLYOFFICE Docs. - Moodle v3.9.10 or later
- ONLYOFFICE Connector v3.0.0 for Moodle
Installing the ONLYOFFICE connector for Moodle
Installing the ONLYOFFICE connector using the Moodle plugin library
-
Log as an admin into your Moodle instance and go to Site administration > Plugins > Install plugins.
If you can’t find this location, then plugin installation is disabled on your site.
- Click the Install plugins from Moodle plugins directory button.
- Select your current Moodle version.
- Search for the ONLYOFFICE document plugin.
- Click the Install button, then click Continue.
- Confirm the installation request.
-
Check the plugin validation report.
Important Choose your Moodle version correctly. If you mistakenly download and install the wrong version of the plugin for your Moodle server, this may lead to some serious problems, even freezing of the Moodle site.
Installing the ONLYOFFICE connector using the GitHub .ZIP archive
- Download the connector from the GitHub page.
- Log into your Moodle instance as an administrator, go to the Site administration section, switch to the Plugins tab, and click the Install plugins link.
-
Upload the moodle-mod_onlyofficeeditor-x.x.x.zip file via the file picker or drag-and-drop it to the corresponding field and click the Install plugin from the ZIP file button.
-
Check the plugin validation report and click Continue.
If your target directory is not writable, you will see a warning message, e.g.
[Error] Write access check [/var/www/html/moodle/mod]
. In this case, you can temporarily make it writable by using the following command:sudo chmod -R 777 /var/www/html/moodle
After that, repeat Step 3.
After installing the plugin, you need to revert permissions so that the directory is no longer writable. Use the following command:
sudo chmod -R 0755 /var/www/html/moodle
- Click Continue on the Current release information -> Server checks page.
-
Click Upgrade Moodle database now on the Plugins check page.
- Click Continue on the Upgrading to new version page.
Configuring the ONLYOFFICE connector for Moodle
Once the plugin is installed, the plugin settings page will be opened. Alternatively, you can find ONLYOFFICE document on the Plugins overview page and click Settings. On the Settings page, you can configure the following parameters:
-
Enter the address that is used to access Document Editing Service from Moodle into the Document Editing Service address field. This field is obligatory.
The address of ONLYOFFICE Docs must be accessible from Moodle, as well as the address of Moodle must be accessible from ONLYOFFICE Docs.
-
Optionally, specify the secret used to sign the data in the Document Server Secret field. The secret key is used to validate the JSON web token upon the request to Document Server. To learn more, check the API documentation for configuring JWT on the ONLYOFFICE Docs side.
Starting from ONLYOFFICE Docs v7.2, JWT is enabled by default and the secret key is generated automatically. You need to enable it on the Moodle side as well: find your secret key in the ONLYOFFICE Docs configuration file, then specify the same secret key in the connector settings. For more details, see the Enabling JWT for the ONLYOFFICE and Moodle integration section of this article.
- Enable Force Save - when this option is disabled, your changes are saved to the editors’ cache automatically. When this option is enabled, all changes to a document are sent to the storage directly when you click the Save button.
-
Optionally, specify the editor customization settings by checking the necessary boxes:
- Display Chat menu button - this option is used to display or hide the Chat menu button.
- Display Help menu button - this option is used to display or hide the Help menu button.
- Display the header more compact - this option is used to display the additional action buttons either in the upper part of the editor window header next to the logo or in the toolbar.
- Display Feedback & Support menu button - this option is used to display or hide the Feedback & Support menu button.
- Display monochrome toolbar header - this option is used to display the editor toolbar in monochrome.
When ready, click Save changes.


Enabling JWT for the ONLYOFFICE and Moodle integration
To protect documents from unauthorized access, ONLYOFFICE editors use the JSON Web Token (JWT). The token is added in the configuration when the Document Editor is initialized and during the exchange of commands between inner ONLYOFFICE Docs services. The secret key is used to sign the JSON web token and validate the token upon the request to ONLYOFFICE Docs.
Starting from ONLYOFFICE Docs v7.2, JWT is enabled by default and the secret key is generated automatically. You need to find your secret key in the ONLYOFFICE Docs configuration file, then specify the same secret key in the connector settings.
Step 1: Find your secret key in the ONLYOFFICE Docs configuration file
-
Open the local.json file with any available text editor.
- For Linux -
/etc/onlyoffice/documentserver/local.json
- For Windows -
%ProgramFiles%\ONLYOFFICE\DocumentServer\config\local.json
-
For Docker – enter the ONLYOFFICE Docs container using the
docker exec -it <containerID> bash
command and open/etc/onlyoffice/documentserver/local.json
The local.json file should look like this:
{"services": {"CoAuthoring": {"token": {"enable": {"request": {"inbox": true,"outbox": true},"browser": true}},"secret": {"inbox": {"string": "yoursecret"},"outbox": {"string": "yoursecret"},"session": {"string": "yoursecret"}}}}}
- For Linux -
-
The
true
value is specified in three sections. It means that token validation is enabled.services.CoAuthoring.token.enable.browser
services.CoAuthoring.token.enable.request.inbox
services.CoAuthoring.token.enable.request.outbox
-
The automatically generated secret key is specified in three sections. You can replace the default secret value with your own secret key. The secret key must be the same in three sections.
services.CoAuthoring.secret.inbox.string
services.CoAuthoring.secret.outbox.string
services.CoAuthoring.secret.session.string
-
If you make changes, save them and restart the services for the config changes to take effect.
supervisorctl restart all
Step 2: Specify the same secret key in the connector settings
In the connector settings, specify the same secret in the Secret key field and save the settings.
Start using ONLYOFFICE Docs within Moodle
Adding ONLYOFFICE activities
To create a new ONLYOFFICE activity:
- Open the My Courses section and switch to the necessary course.
- Activate the Edit Mode using the switcher at the top right corner.
- Click Add an activity or resource.
-
Select the ONLYOFFICE document activity in the pop-up window.
-
Type in the activity name, create, upload or drag-and-drop the necessary document from your PC and click the Save and display button.
The activity can be an empty
.docx
,.xlsx
,.pptx
or.docxf
file.
The document will be opened in the ONLYOFFICE Docs editor.


Viewing and editing files
ONLYOFFICE activities will be marked with the icon on your course pages. To open a document in the ONLYOFFICE Docs editor, just click its title.


To open the editor in fullscreen mode, click the Open full screen button at the top right corner above the editor window.
Protecting files with a password
ONLYOFFICE files can be protected with a password so as to prevent unauthorized access. To do that,
- Go to the File tab at the top toolbar.
- Select the Protect option.
- Click the Add password button.
-
Set a password in the Password field and repeat it in the Repeat password field below, then click OK.
ImportantThe password cannot be restored if you lose or forget it. Please keep it in a safe place.
To change a password,
- Go to the File tab at the top toolbar.
- Select the Protect option.
- Click the Change password button.
- Set a password in the Password field and repeat it in the Repeat password field below, then click OK.
To delete a password,
- Go to the File tab at the top toolbar.
- Select the Protect option.
- Click the Delete password button.
To disable the protection option,
- Go to the activity editing page.
- Open the Document permissions section.
- Check the Hide Protection tab box.
Managing permissions
Admins/Teachers can choose whether or not documents can be downloaded or printed from inside the ONLYOFFICE editor. This can be done in the Document permissions section.


To change the document permission to read-only:
- Open the needed ONLYOFFICE document.
- Go to More -> Permissions.
- Find the Edit ONLYOFFICE document activity/View ONLYOFFICE document activity entry.
- Add the required roles in the Prohibited section or remove the ones from the Roles with permission section.


To learn how to mark the document as favorite right in the editor, please follow the instructions from this article.