- Home
- Connectors
- Moodle
Moodle
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.
You can also install the Moodle Assign Submission ONLYOFFICE Integration plugin. This plugin is an extension of the main Moodle plugin and allows users to add a custom submission of the ONLYOFFICE document type in the pdf format.
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, PDF
- For viewing only: TXT, CSV
- For filling forms: PDF
What's new in version 6.0.1
Added
- Added fi, he, no, sl language templates
Changed
- JWT header issue fixed
- Removed trailing slashes from setting urls after update
The full change log is available here.
Connecting ONLYOFFICE Docs to Moodle
Requirements
- ONLYOFFICE Docs (Document Server) 6.1.0 or higher (server or cloud version)
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 v4.9 or later
- ONLYOFFICE Connector v4.4.0 is used for Moodle v4.3.0; v4.3.0 is used for Moodle v4 < 4.3.0; v4.2.0 is used for Moodle v3.9 - 3.11
Installing the ONLYOFFICE connector for Moodle
The ONLYOFFICE plugin for Moodle is an activity module.
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 in the Current release information -> Server checks page.
-
Click Upgrade Moodle database now in the Plugins check page.
- Click Continue in the Upgrading to new version page.
Installing the Moodle Assign Submission ONLYOFFICE Integration plugin
-
Log as an admin into your Moodle instance and go to Site administration >
Plugins > Install plugins.
If you cant 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 Assign Submission plugin.
- Click the Install button, then click Continue.
- Confirm the installation request.
-
Check the plugin validation report.
It is extremely important that you 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.
Alternatively, you can download the plugin from the GitHub page and install it from the ZIP file.
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 mandatory.
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.
- Enable plugins - this option is used to enable/disable the Plugins tab in the editors interface.
- Run document macros - this option is used to enable/disable autorun for all macros within the document. You can always run macros manually.
When ready, click Save changes.


How it works
The user-document interaction is done both at the client side and at the server side.
Below the main notions used throughout the current documentation are explained.
The client side includes:
- Document manager - the list of the documents displayed in the user browser where the user can select the necessary document and perform some actions with it (depending on the provided rights, the user can open the document to view it or edit, share the document with other users).
- Document editor - the document viewing and editing interface with all the most known document editing features available, used as a medium between the user and the document editing service.
The server side includes:
- Document storage service - the server service which stores all the documents available to the users with the appropriate access rights. It provides the document IDs and links to these documents to the document manager which the user sees in the browser.
- Document editing service - the server service which allows to perform the document viewing and editing (in case the user has the appropriate rights to do that). The document editor interface is used to access all the document editing service features.
- Document command service - the server service which allows to perfom additional commands with document editing service.
- Document conversion service - the server service which allows to convert the document file into the appropriate Office Open XML format (docx for text documents, xlsx for spreadsheets and pptx for presentations) for their editing or downloading.
- Document builder service - the server service which allows to build a document easily without the need to actually run a document processing editor.
Please note, that ONLYOFFICE Document Server includes the document editor, document editing service, document command service, document conversion service and document builder service. The document manager and document storage service are either included in the Community Server or must be implemented by the software integrators which use ONLYOFFICE Document Server on their own server.
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.pdf
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.
Adding submissions
To add a custom submission of the ONLYOFFICE document type in the .pdf
format,
- 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 Assignment activity in the pop-up window.
- In the Submission types tab, select the ONLYOFFICE document type. Once done, the form
creator (
.pdf
) will become available on the Assignment creation/editing page here you can prepare a form which will become available for students to fill out after saving. - Click Save and return to course or Save and display. The created assignment will appear in the course section.


Filling out forms
To fill out the form,
-
Select the created assignment and click Add submission.
- The form in the
.pdf
format will open (for Docs v8.0 or later. For older versions, the.oform
format is used). Each student gets their own copy of the pdf form and works on their own assignment. - Fill out the form and click Save changes.
A teacher can view all assignments by clicking the View all submissions button.
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.