Nextcloud Storage Setup Guide
This guide sets up a Waldur offering that sells shared Nextcloud storage. Each order becomes a Nextcloud Team folder (Group Folders app) with the ordered quota, the project team gets access to it, and users log in to Nextcloud through the same Keycloak realm as Waldur.
With preprovision_users on, the site agent creates each member's Nextcloud account as soon as they get
access in Waldur, so a user who orders storage before ever opening Nextcloud finds the folder waiting at
their first login.
The screenshots were taken on a local stack: Nextcloud 31.0.14 with user_oidc 8.13.0 and Team folders
(groupfolders), Keycloak 26.0.7, and Waldur develop (December 2026).
How it works
1 2 3 4 5 6 7 8 9 | |
| Waldur | Nextcloud |
|---|---|
| Resource | Group waldur-<resource uuid> and a Team folder <project>/<resource>-<uuid prefix> |
| Storage limit (GiB) | Team folder quota |
| Offering user (username) | Account with that uid, created through user_oidc |
| Project member added / removed | Account added to / removed from the group |
The account is created through user_oidc's provisioning API, so it belongs to the identity provider:
it has no password, no welcome email is sent, and the user's first Keycloak login lands in it because
user_oidc finds the account by provider and uid claim.
Prerequisites
- Nextcloud 29 or newer, served over HTTPS, with an admin account (or app password) for the agent.
- The OpenID Connect user backend app (
user_oidc) 6.1.0 or newer, and Team folders (groupfolders; called Group Folders before Nextcloud 31). - A Keycloak realm that Waldur users sign in with, so a Waldur username and the Keycloak
preferred_usernameare the same string. - A Waldur organization registered as a service provider, and the site agent installed with the
waldur-site-agent-nextcloudplugin.
Step 1: Create the Keycloak client
In the realm your users sign in with, create an OpenID Connect client for Nextcloud:
| Field | Value |
|---|---|
| Client ID | nextcloud |
| Client authentication | On (confidential client) |
| Authentication flow | Standard flow only |
| Valid redirect URIs | https://<nextcloud>/apps/user_oidc/code (plus /index.php/… without pretty URLs) |
| Web origins | https://<nextcloud> |
Copy the client secret from the Credentials tab.
Step 2: Configure Nextcloud
2.1 Install the apps
1 2 | |
2.2 Register Keycloak as an OpenID Connect provider
1 2 3 4 5 6 7 8 | |
Two settings matter for the agent:
- User ID mapping must be
preferred_username: the account's uid is then the Keycloak username, which is the name Waldur sends. - Use unique user ID must be off. With it on,
user_oidcstores every account under a hash of provider and user id, and the agent refuses to pre-provision (see Troubleshooting).
The same settings in Administration settings → OpenID Connect:
Note the provider's numeric id, which goes into the agent configuration as oidc_provider_id:
1 2 3 4 5 6 | |
2.3 Harden account matching
With "unique user ID" off, a Keycloak user whose username equals an existing local Nextcloud account
logs in as that account — on a default install, a Keycloak user called admin becomes the Nextcloud
admin. Turn off soft auto-provisioning, which is what links the two, and let only the agent create
accounts:
1 2 | |
| Setting | Effect |
|---|---|
soft_auto_provision=false |
A login whose uid matches a local account is refused ("user conflict"), not merged |
disable_account_creation=true |
A Keycloak user Waldur has not provisioned cannot create an account by logging in |
Both were checked on the stack above: the provisioning API and the accounts it created keep working.
Leave disable_account_creation off if people outside Waldur also use this Nextcloud.
Step 3: Create the offering in Waldur
3.1 New offering
In the service provider's organization open Service provider → Service catalog → Offerings and click Add:
| Field | Value |
|---|---|
| Name | Nextcloud Storage |
| Category | Storage |
| Type | Waldur site agent |
The offering UUID in the editor's URL is the agent's waldur_offering_uuid.
3.2 Offering users
Under Edit → Integration → User management:
- Offering users → Enable automatic creation of offering users: on. Without it a project member gets no offering user and is never synced.
- Accounts → Username generation policy: a policy that yields the Keycloak
preferred_username. When Waldur users sign in through the same realm, that is Waldur username.
The agent provisions Nextcloud accounts under the offering username, never the Waldur username, and only for offering users in state OK.
3.3 Storage component and plan
Under Accounting → Components, add one component:
| Field | Value |
|---|---|
| Name / type | Storage / storage |
| Billing type | Limit-based |
| Unit | GiB |
Add a plan under Accounting → Plans with a price per GiB, then Activate the offering.
Step 4: Configure the site agent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
admin_username must be a Nextcloud admin: the provisioning API and the provider listing are admin-only.
Prefer an app password (Personal settings → Security → Devices & sessions) to the account password.
Check the configuration before starting the agent:
1 2 3 4 5 6 | |
Diagnostics fail if oidc_provider_id names no provider or the provider has "unique user ID" on.
Step 5: Order storage
A project member orders the offering from the service catalog and sets the storage limit:
Depending on the organization's settings the order waits for consumer and provider approval. Once approved, the agent creates the group and the Team folder, pre-provisions the project team and adds them to the group. The resource turns OK; its backend id is the Team folder id.
The agent log for the order:
1 2 3 4 5 6 7 | |
In Nextcloud the accounts exist before anyone has logged in, and the folder carries the ordered quota:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
backend: user_oidc and first_seen: never are what pre-provisioning produces: an account of the identity
provider that has not been used yet.
Step 6: First login
The user picks Login with keycloak (the button shows the provider's identifier) and signs in:
They land in the pre-provisioned account — same uid, same group — and find the folder under Team folders:
Team changes
Membership sync (or STOMP events) keeps the group in line with the project team. Adding owner to the
project and removing member:
1 2 3 4 | |
Removal takes the user out of the group, so the folder disappears from their files; the account itself stays, since the user may own other files. Terminating the resource deletes the Team folder and the group.
Troubleshooting
oidc_provider_id=… matches no user_oidc provider
user_oidc does not check the provider id it is given: for an unknown id it would create the account
under a hash. The agent therefore reads the provider list first and pre-provisions nobody until the id
matches. Fix oidc_provider_id (occ user_oidc:provider); no restart is needed.
… has 'unique user id' on … not pre-provisioning users
Turn the setting off: occ user_oidc:provider keycloak --unique-uid=0. Accounts created while it was on
are named by hashes and are not linked to the usernames Waldur sends.
user_oidc created the account for alice as '5f2b9c…', not as the username
The account was created under a hash, typically on a user_oidc release without the provider listing,
so the up-front check could not run. The agent does not add it to the group: access granted to a hash
could never be removed again. Fix the provider, then delete the stray account with the command from the
log line (occ user:delete <uid>).
"You must access Nextcloud with HTTPS to use OpenID Connect"
user_oidc refuses OIDC logins over plain HTTP. Serve Nextcloud over HTTPS, or set overwriteprotocol
to https behind a TLS-terminating proxy. For a throwaway local test only:
occ config:app:set user_oidc allow_insecure_http --value=1 --type=boolean --lazy.
Login refused with "user conflict"
With soft_auto_provision=false, a Keycloak user whose username matches a local (non-OIDC) Nextcloud
account cannot log in. That is the protection from step 2.3. Rename the
local account or the Keycloak user.
The folder is missing for a user
- Is the user's offering user in state OK, and is its username their Keycloak
preferred_username? The agent provisions and adds the offering username only. - A WebDAV client that opens a path inside the folder directly, without ever listing the root, can get a 404 right after being added to the group; Nextcloud refreshes a user's mounts on a root listing, which the web UI and desktop clients do.
Reproducing this setup locally
The screenshots come from this stack; HTTPS is replaced by allow_insecure_http, which is for local
testing only. Keycloak is reached as host.docker.internal:18180 from both the browser and the Nextcloud
container (map that name to 127.0.0.1 on the host).
1 2 3 4 5 6 7 | |
Then follow steps 1–6 with http://localhost:18181 as the Nextcloud URL (docker exec -u www-data nc php occ …
for the occ commands), and create Keycloak users with the same usernames as the Waldur users. After
installing user_oidc in step 2.1, allow plain HTTP:
1 | |














