Moodle and Nextcloud file integration

Moodle can pull files from and push files to a self-hosted Nextcloud through the core Nextcloud repository, signed in with Moodle's OAuth 2 services. This page explains the setup sequence, permission mapping, testing and the failures teams hit most.

On this page

How the Moodle Nextcloud file integration works

An institution that keeps its files in a self-hosted Nextcloud can let teachers and students pick those files inside Moodle without downloading and re-uploading them. The core Nextcloud repository plugin in Moodle does this: it connects the Moodle file picker to the user's own Nextcloud files, so a teacher adds a file to a course or an assignment by choosing it from Nextcloud. Sign-in for that connection runs through Moodle's core OAuth 2 services, which means Nextcloud must be registered in Moodle as an OAuth 2 issuer before any user can reach their files.

The picker works against each user's own Nextcloud files, not a shared pool. A student sees what that student can already open in Nextcloud, and a teacher sees the teacher's folders and any content Nextcloud has shared with them. The integration does not replace Nextcloud permissions, so a file that a user cannot open in Nextcloud will not become available through Moodle. It also does not change how Moodle stores course files. When a file is attached, Moodle stores its own reference or copy under its normal file handling, so the decisions about where course files live, how long they persist and who can see them in Moodle stay as they were. Teams should confirm how the chosen Moodle version handles linked files in their own test site before promising behavior to course designers.

We plan, configure and test this integration inside the client's infrastructure, with the Moodle and Nextcloud hosts, the OAuth 2 issuer settings, the sign-in path and the file picker checked together. The decisions to make first are which Nextcloud sharing and group settings the course teams depend on, whether students will use the same sign-in as the rest of the institution, and which Moodle roles should see the repository at all. Check the Nextcloud and Moodle versions you run against the supported releases listed in the vendor documentation, because the upgrade order for each platform affects the integration.

Prerequisites for Moodle Nextcloud file integration

Four decisions and checks need to be settled before anyone touches the repository plugin or OAuth 2 settings: the Moodle release and its server stack, the Nextcloud release and its stack, TLS on both hosts, and the admin accounts on each side. Getting these right first avoids rework when the integration is tested across both systems.

Moodle release and server stack

Choose the Moodle release first, because it sets the PHP, database and web server rules. From Moodle 5.1, the web server document root must point to the /public directory rather than the main Moodle folder, or the site may show directory listings or errors. Moodle 5.1 requires 64-bit PHP 8.2 or later, and Moodle 5.3 requires 64-bit PHP 8.3 or later. Check the upgrade path in the release notes before you start, because sites must already be on a minimum version to upgrade.

Moodle 5.1 notes

Nextcloud release and supported stack

Pick the Nextcloud major version your organization will run and record its supported PHP, database and web server combinations from the system requirements page. Nextcloud 35 recommends MariaDB 11.8 or PostgreSQL 18 and supports Apache 2.4 or nginx with php-fpm. Confirm that your chosen version still receives maintenance, because Nextcloud does not allow skipping major releases during upgrades.

Nextcloud requirements

Version compatibility confirmation

Before work starts, confirm in writing that the Nextcloud repository plugin and the OAuth 2 service are supported on your exact Moodle and Nextcloud versions. Compatibility can differ between releases, so do not rely on general statements. Record the versions tested so the same pairing can be reproduced during upgrades on either side.

TLS on both hosts

Both Moodle and Nextcloud must be served over HTTPS with valid certificates that the other host trusts, because the OAuth 2 exchange and file browsing depend on it. Confirm the certificate chain is complete, that internal certificate authorities are trusted by the Moodle PHP process, and that redirect URLs use the exact public hostnames. Mixed HTTP and HTTPS hostnames are a common cause of failed sign-in loops.

Admin accounts on each side

Plan named administrator accounts on Moodle and on Nextcloud before configuration begins. The Moodle administrator registers the OAuth 2 service and enables the repository, while the Nextcloud administrator creates the OAuth client and sets its redirect URI. Keep these accounts separate from everyday teaching accounts, use multi-factor authentication where each platform supports it, and confirm who holds each role if staff change.

Nextcloud user authentication

How a file pick travels from Moodle to Nextcloud

The flow starts in the browser, when a teacher or student opens the Nextcloud repository in Moodle's file picker. Moodle redirects the browser to Nextcloud for OAuth 2 authorization, and Nextcloud returns a token that Moodle uses to list and fetch the chosen file. The copy lands in the course or submission inside Moodle. Check each hand-off: the browser crosses the boundary between Moodle and Nextcloud, and the file itself is stored behind Nextcloud, so the storage path needs its own review.

Request flow for one file pick, from the Moodle file picker to the copied file.

Configuring the OAuth 2 service and repository in order

This sequence connects Moodle to a self-hosted Nextcloud so that teachers and students can sign in with their own credentials and pick files from Nextcloud inside Moodle. Each step closes with a check, so problems surface before users depend on the integration.

  1. Confirm versions and the Nextcloud URL

    Before changing anything, record the Moodle version and the Nextcloud version in use, along with the exact public HTTPS address of each. The Moodle site must be reachable from the Nextcloud server and the Nextcloud site must be reachable from users' browsers, because the OAuth 2 flow passes through both. Confirm menu paths and field names against the Moodle and Nextcloud documentation for those exact versions, since labels change between releases. The check is a written record of both versions and both addresses, plus a successful browser load of each site over HTTPS.

  2. Create the OAuth 2 client in Nextcloud

    A Nextcloud administrator creates an OAuth 2 client in the Nextcloud administration settings and enters the redirect URI that Moodle's OAuth 2 service presents. Copy the redirect URI from the Moodle OAuth 2 service screen rather than typing it, since a single character mismatch will break sign-in. Save the generated client ID and client secret in your secrets store, not in a shared document. The check is that the client appears in the Nextcloud list with the expected redirect URI.

  3. Create the matching OAuth 2 service in Moodle

    A Moodle administrator creates an OAuth 2 service in the Moodle site administration, selects the Nextcloud issuer type, and enters the client ID, client secret and Nextcloud base address from the previous step. Confirm the service's redirect URI matches what was registered in Nextcloud. The check is that the service saves without error and shows as enabled, and that a test connection to the Nextcloud server reports the expected endpoints.

  4. Enable the Nextcloud repository plugin

    In Moodle, a site administrator enables the Nextcloud repository plugin and confirms it is linked to the OAuth 2 service created in the previous step. Review the repository settings and decide which Nextcloud folders or capabilities users will see, such as viewing, downloading and creating share links. The check is that the repository appears as an available file source in the Moodle administration list for repositories.

  5. Assign repository capabilities to teacher and student roles

    Review the repository capabilities in Moodle and assign them to the roles that need them, usually the teacher and editing teacher roles for course file areas and the student role only where students should attach their own files. Check the capabilities against your institution's sharing rules before assigning them, and record which roles received which capability. The check is a role-permission review that matches the written access decision, confirmed by viewing the capability overview for each role.

  6. Test sign-in and token exchange with a teacher account

    Sign in to Moodle with a test teacher account, open a test course, and open the file picker for a resource or assignment. Choose the Nextcloud repository, complete the Nextcloud sign-in and consent screen, and watch for a successful token exchange. The check is that the Nextcloud folder listing loads in the picker and that a test file can be copied into the course. Record any error message exactly, because token and redirect errors usually trace back to the client settings from earlier steps.

  7. Test sign-in with a student account

    Repeat the test with a student account in a course where the student role has the agreed capabilities. Confirm that the student completes the consent flow, sees only the files and capabilities your access decision allows, and can attach a file to an assignment submission. The check is a file submitted from Nextcloud to an activity in the test course, and a confirmed denial for any capability the student role was not given.

  8. Remove the test data and record the configuration

    Delete the test course files, test shares and any test accounts that should not persist, then document the final OAuth 2 client settings, repository settings and role assignments. Store the record with your change log so that the next Moodle or Nextcloud upgrade can be checked against it. The check is a clean test course, a completed configuration record and a sign-off from the administrators who owned each system.

What changes for teachers and students in the file picker

Once the Nextcloud repository is live, a teacher or student opens the file picker in a course activity or submission, chooses the Nextcloud option, and signs in to Nextcloud through Moodle's OAuth 2 connection. They then browse their own Nextcloud folders and attach a file to the activity. The main change for users is that Nextcloud becomes a second place to keep course material, so the first thing to confirm is which activities in your installation expose the repository and whether your teachers expect to see it there. Run the full path with a teacher account and a student account on your own Moodle and Nextcloud versions before you announce it, because the picker's labels and behavior depend on how each plugin is configured.

Two consequences surprise people. First, a file chosen from Nextcloud is either a reference to the Nextcloud original or a copy stored in Moodle, and the answer depends on the activity type and on the repository settings for that activity. Test each activity you plan to support, then check what happens when the owner later renames, moves or deletes the file in Nextcloud, because a reference can break and a copy can drift from the source. Second, access still follows Nextcloud permissions, not Moodle enrolment. A student enrolled in a course cannot open a teacher's shared Nextcloud file unless Nextcloud grants that student access, and a file shared with a link can be opened by anyone who holds it.

Account lifecycle is the third surprise. Signing in through Moodle does not remove a user's Nextcloud account when they leave the institution, and Moodle enrolment removal does not disable it either. Confirm with your identity team who disables Nextcloud accounts, how that is triggered, and whether files owned by departed users are transferred or retained under your records policy. Record the answers as acceptance tests so that a leaver test is repeated on every upgrade of either system.

Accounts, permissions and file paths mapped between Moodle and Nextcloud

This table maps each Moodle identity and access item to its Nextcloud counterpart, so the team can see where a user, role or folder on one side has no direct equivalent on the other. Read each row as a decision to agree with the identity owner before any test account is created. The main takeaway is that the Nextcloud account, not the Moodle account, decides what files a person can reach, so both sides must match before rollout.

ItemMoodle sideNextcloud side
User accountMoodle user record created by the chosen authentication method, such as OAuth 2 or LDAPNextcloud account that owns the user's files and sharing history; the two accounts are linked by login or identifier, not by a shared database
OAuth 2 clientMoodle OAuth 2 service configured with the Nextcloud client ID, secret and endpointsApplication registered in Nextcloud with a redirect URI that must match the Moodle site exactly, including the scheme and path
Repository accessMoodle roles and capabilities that allow the Nextcloud repository in the file pickerNextcloud permissions on the folders and files the user can open, which the picker displays as the user sees them
Folder visibilityRepository shows the path the logged-in Nextcloud user can accessShared folders, group folders and external shares appear only if the Nextcloud account has access; confirm which folders teachers should see
Matching users from LDAP or Active DirectoryMoodle matches the same person by a stable username or identifierNextcloud LDAP user authentication lets directory users appear and log in with directory credentials (Nextcloud LDAP user authentication docs); agree which attribute is the unique identifier
Role changesMoodle role assignments change when enrolments or cohorts changeNextcloud group membership changes separately; confirm who owns each change and how often they are reviewed
LeaversMoodle account suspended or deleted through the chosen processNextcloud account disabled and files reassigned or retained under a documented policy; confirm the retention rule with the data owner

Security settings for the Moodle Nextcloud file integration

The Moodle to Nextcloud link carries user sessions, OAuth 2 tokens and course files across two systems, so each side needs its own controls. The cards below cover transport, credentials, access, sharing, app governance and logging, and each one names a setting your team can verify in both platforms.

TLS on both hosts

The OAuth 2 redirect and token exchange only work safely over HTTPS, so both the Moodle and Nextcloud hostnames need valid certificates that the other server trusts. Check that Moodle's wwwroot and the Nextcloud external address use ` that certificate chains are complete, and that the Nextcloud host name in the Moodle service matches the certificate. Confirm how your internal certificate authority is added to the PHP trust store on the Moodle servers.

Nextcloud requirements

OAuth 2 client secrets under policy

The Nextcloud OAuth 2 client secret that Moodle stores is a credential, so it belongs in your secrets manager and follows your rotation schedule. Record who can read the Moodle OAuth 2 service configuration, and plan a rotation that updates the Nextcloud client and the Moodle service together. Ask your team to confirm where the secret is held at rest and whether database backups include it.

Repository access by role

The Nextcloud repository plugin can be enabled for specific Moodle roles, so restrict it to teachers and students who need to pick files rather than every user. Review the capability settings for the repository and the course contexts where it appears. Test with a non-teacher account that the file picker does not show Nextcloud, and record the result in your change log.

Sharing rules for course files

Files pulled into a course often become visible to every enrolled student, and a share link created in Nextcloud can outlive the course. Review Nextcloud's default share permissions, whether link shares to external recipients are allowed, and expiry defaults for those links. Agree with the institution which sharing settings apply to course material, and test that a link created for a course file expires as the policy requires.

Third-party app governance

Nextcloud does not allow skipping major releases during upgrades, and third-party apps can block an upgrade or change how files are handled. Keep the app list short, disable third-party apps until they are confirmed compatible with the Nextcloud version in use, and record each approval. Make sure the Moodle integration is tested again after every Nextcloud major or maintenance upgrade.

Nextcloud upgrade manual

Audit logging on both sides

A file access question from a regulator or a course dispute needs logs from both systems, and they need to be kept long enough to answer it. Enable Moodle's logging for authentication and the repository, and enable Nextcloud's audit logging, then confirm that each log is forwarded or retained under your retention policy. Check that the logs record user identity in a way that lets the two systems be matched by time and account.

Common Moodle Nextcloud integration failures and fixes

This table lists the failures teams most often hit when connecting Moodle to Nextcloud, with the likely cause, the check that confirms it and the fix for each. Work down the rows in order when a repository does not appear or a login or file fetch fails, because several symptoms share causes. The main takeaway is that most failures come from mismatched settings on the two sides, not from the plugin itself.

FailureLikely causeCheck that confirms itFix
Redirect URI mismatchThe callback URL registered in Nextcloud's OAuth 2 settings does not match the URL Moodle sends, often because of http versus https, a different host name or a missing path segment.Compare the redirect URI shown in Moodle's OAuth 2 service with the one stored in Nextcloud, character by character, and check the Moodle login error text.Copy the exact URI from the Moodle service into the Nextcloud client entry, then save and retest the connection from a clean browser session.
Certificate trust error when Moodle calls NextcloudNextcloud uses a certificate from an internal certificate authority that the Moodle web server or PHP does not trust, or the chain is incomplete.Run a TLS check from the Moodle server against the Nextcloud host and look for a verification failure in Moodle's logs or the repository error.Install the internal root and intermediate certificates into the operating system and PHP trust store on the Moodle server, then restart PHP-FPM and the web server.
Clock or time drift breaks token validationThe Moodle and Nextcloud servers, or the client, have clocks that differ enough for OAuth 2 access tokens to appear expired or not yet valid.Compare the system time on both servers with a trusted time source and review token errors for expiry or issued-at messages.Enable time synchronization (NTP or the platform equivalent) on both servers and confirm the offset is cleared before retesting.
Repository missing for a roleThe repository capability was not assigned to the role, or the role is not allowed to use the Nextcloud repository in the relevant context.Check the Nextcloud repository's capability settings in Moodle and compare the role's permissions in the course and category context for a teacher and a student.Assign the repository capability to the required roles in the right contexts, then have a test user open the file picker to confirm the repository appears.
Document root points at the wrong folder after upgrading to 5.1 or laterFrom Moodle 5.1 the web server document root must point to the /public directory, so an upgrade that keeps the old root can expose the main folder or show errors.Read the web server's configured document root and confirm it targets the public directory of the Moodle installation, then load the site and check for directory listings or errors.Update the document root in the web server configuration to the /public directory, reload the server and confirm the OAuth 2 and repository pages load normally.
Nextcloud upgrade disables the app or breaks compatibilityNextcloud requires one major version at a time and disables third-party apps that are not compatible with the new release, and the Moodle-facing OAuth 2 settings may then change or stop responding.Review the Nextcloud upgrade log and app list for disabled apps, and confirm the OAuth 2 client and the Moodle repository still authenticate after the change.Restore from the pre-upgrade backup if needed, upgrade one major version at a time, confirm app compatibility first, and re-enable and retest the OAuth 2 client before Moodle users rely on it.

Who does the work: the in-house team or a partner

An in-house team that already administers both Moodle and Nextcloud can do this integration itself. The work is mostly configuration: creating an OAuth 2 service in Moodle, registering Moodle as a client in Nextcloud, enabling the Nextcloud repository plugin, and testing file picking and sharing for each role. The main risk is not the configuration but the cross-team coordination, since the Moodle admin and the Nextcloud admin must agree on the redirect URL, client identifier and secret handling.

  • Admin access: Site administrator rights on Moodle and an administrator account on Nextcloud, plus access to the server where each runs.
  • Test accounts: One teacher and one student account on each platform, with known permissions, for repeatable checks.
  • Change window: A window agreed with both teams, since enabling the repository affects live course editing.
  • What you receive: Your own documented configuration, which the team must write down itself, along with the test results you record.
  • What to confirm: That your Nextcloud version and Moodle version are both on supported release lines, and that someone owns each upgrade after go-live.

Before choosing this route, confirm that the team has done an OAuth 2 setup before and can name who maintains the integration when either platform is upgraded.

What does a Moodle Nextcloud integration cost and take?

What drives the cost of a Moodle and Nextcloud integration?

Cost follows the amount of configuration and testing the integration needs, not the plugin itself, since the Nextcloud repository ships in Moodle core. The main drivers are the number of environments (development, test and production each need a configured OAuth 2 service and a Nextcloud client), custom Moodle roles that control who sees which repository, whether users sign in through LDAP, Active Directory or SSO, and how far apart the Moodle and Nextcloud versions are. Test scope matters too: a few teacher and student scenarios cost less to verify than a full matrix of roles, courses and file types. Ask any quote to list each environment, role, identity dependency and test case separately so you can see what changes the price.

How long does a Moodle Nextcloud file integration take?

Duration depends on scope, and no fixed figure applies to every institution. A single environment with one identity source and standard roles is the shortest path. Each added environment, identity dependency or custom role extends design, configuration and testing. Upgrade timing also matters: Nextcloud requires one major version at a time, so a site several majors behind needs staged upgrades before the integration begins. Ask for a timeline tied to a written scope with named milestones, and confirm which change windows the work depends on.

Can our own team set up the Moodle Nextcloud integration alone?

A team with Moodle administration experience and someone who runs Nextcloud can usually configure the core repository and OAuth 2 service in a test environment on their own. The harder parts are the production-grade pieces: registering the OAuth 2 client in Nextcloud with correct redirect addresses, matching user identities across LDAP or SSO, deciding which roles see the repository, and proving that file access, sharing and permissions behave as expected. Check whether your team has time for testing and for the upgrade steps that follow. Many institutions split the work, keeping routine administration in-house and bringing in a partner for design and verification.

What does the client need to provide for the integration?

Plan to provide administrator accounts on both Moodle and Nextcloud, a named owner for each system, and access to the identity source if users sign in through LDAP, Active Directory or another SSO provider. You will also need test users covering teacher, student and any custom roles, a staging copy of each system, and change windows for production work. Confirm the hostnames and TLS certificates that Moodle and Nextcloud will use, since OAuth 2 redirects depend on them. Written scope should list each of these items with who supplies it and by when.

What recurs after go-live for Moodle and Nextcloud?

The integration needs ongoing checks because both platforms release updates on their own schedules. Moodle ships major releases in April and October and minor point releases every two months, and Nextcloud publishes a new major version every four months with monthly maintenance releases. Each upgrade should be followed by a check that the Nextcloud repository still connects, that the OAuth 2 service still authenticates, and that file picking and sharing work. Also plan for renewing the TLS certificates used by both sites, reviewing any third-party apps or plugins for compatibility before upgrades, and keeping backups current before every change. Confirm who owns each of these tasks after handover.

How is the cost of a DeployOpen integration quoted?

DeployOpen does not publish a price list. Most engagements are fixed-scope, so a quote follows from a written scope that lists environments, identity dependencies, roles, test cases, deliverables and the timeline agreed before work starts. Ask the quote to separate one-time work (design, configuration, testing, handover) from recurring work (upgrades, plugin compatibility checks, certificate renewals), and to state what the client must supply. Ongoing support and continuous checks are available as retainers, which you can price separately from the build.

Do Nextcloud licensing costs change the integration cost?

The core Nextcloud repository used by Moodle is part of the community server, so the integration itself does not require a paid Nextcloud subscription. Nextcloud GmbH sells Nextcloud Enterprise, which carries per-user list prices starting at 71.29 euros per user per year for the Standard tier, with a 100-user minimum, according to Nextcloud's pricing page. Whether your institution needs that subscription depends on its support, maintenance and lifecycle requirements, not on the Moodle integration. Confirm your subscription position with Nextcloud before including it in the budget.

How DeployOpen works on this

DeployOpen scopes the Nextcloud repository in writing before any work starts, then configures Moodle's OAuth 2 services and the repository plugin inside your own infrastructure. Each step is tested with real teacher and student accounts, documented, and handed to your team with a plan for upgrades.

How we scope

  • Agree in writing which Moodle sites, courses and user groups will use the Nextcloud repository.
  • Confirm the Nextcloud version, hosting location, and whether Nextcloud is reached over a private network or the internet.
  • Record which Nextcloud folders teachers and students may browse, and which sharing permissions apply.

How we build

  • Create the OAuth 2 issuer in Nextcloud and the matching service in Moodle, with client credentials kept out of shared documents.
  • Enable the core Nextcloud repository plugin and test file picking, linking and copying from both teacher and student roles.
  • Check file permissions, expired tokens and large file behavior against the scope before sign-off.

How we hand over

  • Deliver a configuration record listing settings, service names, redirect addresses and the accounts that own them.
  • Document the test cases used, the results, and the steps to repeat them after an upgrade.
  • Walk your Moodle and Nextcloud administrators through the setup so they can run it without us.

How we support

  • Plan Moodle and Nextcloud upgrades as separate tracks, checking compatibility before each change.
  • Offer ongoing support, upgrades and continuous testing as a retainer if your team wants it.
  • Retest the integration after major releases of either platform, using the written scope as the baseline.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.