Skip to content

triauth for NextcloudOIDC

Let your team open Nextcloud with one approval on their own device, and no Nextcloud passwords.

  • Files and collaboration
  • Open source
Sign-in through
OpenID Connect bridge
Available in
Every Nextcloud, with the OpenID Connect user backend app
Set up in
Administration settings › OpenID Connect

About Nextcloud

Nextcloud is a platform for storing and sharing files, with calendars, contacts, chat, and office documents built around them. Organizations run it on their own servers as a private alternative to Google Drive or Microsoft 365.

Connect Nextcloud to triauth

Nextcloud signs people in through the triauth OpenID Connect bridge, with the OpenID Connect user backend app from Nextcloud's app store. Once connected, Nextcloud's sign-in page shows a button with your domain's name. People on your team click it, type their username, and approve on their own device. Nobody keeps a Nextcloud password, and when someone leaves, removing their identity records at your domain ends their access to Nextcloud as well.

How it works

  1. In Nextcloud, open Apps and install OpenID Connect user backend.
  2. Open oidc.triauth.org and enter your domain. Paste Nextcloud's redirect address, https://cloud.example.com/apps/user_oidc/code with your own Nextcloud address in place of cloud.example.com, and click Connect app. The bridge gives you a client ID and a client secret.
  3. In Administration settings › OpenID Connect, register a provider. Enter your domain as the identifier, paste the client ID and the client secret, enter https://oidc.triauth.org/example.com/.well-known/openid-configuration with your domain in place of example.com as the discovery endpoint, and set the scope to openid email profile groups offline_access. Save.
  4. Open Nextcloud's sign-in page and click the button with your domain's name.

Checkpoint

Nextcloud's sign-in page shows a new button with your domain's name. Choosing it opens a page from the bridge that asks for the username, and the person's authenticator asks them to approve.

Good to know

  • Everyone with an identity at your domain gets a Nextcloud account the first time they sign in. To let only one team in, limit the app to a group when you connect it, or restrict the provider to one group in its settings.
  • Out of the box the app gives new accounts a generated user ID. Turning off its unique user ID option makes each person's identifier their Nextcloud user ID instead, which also keeps existing accounts with that ID.
  • With group provisioning turned on, Nextcloud creates and fills its groups from the groups published at your domain.

For the person who connects the app

SettingValue
Redirect addresshttps://<your-nextcloud>/apps/user_oidc/code
Where in NextcloudAdministration settings › OpenID Connect, or the occ user_oidc:provider command
Discovery endpointhttps://oidc.triauth.org/<your domain>/.well-known/openid-configuration
User IDturn off unique user ID, or pass --unique-uid=0 on the command line, so that user IDs are the identifiers
Groupsthe scope must include groups, then turn on group provisioning for the provider
Sessionsocc config:app:set --value=1 user_oidc store_login_token, together with offline_access in the scope, makes Nextcloud re-check the sign-in with the bridge regularly while a person works. When the identity is gone, or a renewal fails for another reason, Nextcloud signs the person out and sends them back through the bridge. Desktop and mobile clients on app passwords are not affected. Turning the setting on signs out everyone who signed in before it. Left off, Nextcloud's own session rules apply

The same setup on the command line, in the Nextcloud folder:

shell
sudo -u www-data php occ user_oidc:provider example.com \
  --clientid='<client ID from the bridge>' \
  --clientsecret='<client secret from the bridge>' \
  --discoveryuri='https://oidc.triauth.org/example.com/.well-known/openid-configuration' \
  --scope='openid email profile groups offline_access' \
  --unique-uid=0

The app uses PKCE by itself when the discovery document offers it. Its README explains every option.

Next steps

All logos and trademarks belong to their respective owners and do not imply affiliation or endorsement of the organization or product by triauth, nor vice versa. The content provided on this page may include information from third-party sources. We do not assume any responsibility for the completeness, correctness, or applicability of the information. You should independently verify any details before relying on them.