Files
wekan/docs/Features/Login-Page/Nextcloud.md
T
Lauri Ojansivu 74717ea829 Docs: Login Page: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
OAuth2, OAuth providers, SAML, SQRL, Windows SSO, passkeys, two-factor,
passwordless, session cookies, password hashing, autologin, multitenancy,
Nextcloud, Oracle, Zitadel and the Let's Encrypt setup, each in the same
order, checked against the code. Corrected where the code had moved on:
passwordless codes are 10 characters for 15 minutes and are not counted by
the lockout; an OAuth2 login merges an existing account only when enabled
and the email is verified; the Admin Panel sections are under People; the
two-factor entry is hidden only on Sandstorm and for OAuth2 accounts; the
Zitadel example no longer turns on B2C; Rocket.Chat's claim is
preferred_username.

Thanks to xet7 !
2026-11-22 18:05:22 +02:00

5.4 KiB

Login with Nextcloud

What it is

Nextcloud users can sign in to WeKan with their Nextcloud account, in two ways. With OAuth2, Nextcloud is the identity provider of WeKan's generic OAuth2 / OIDC login, and the sign-in page has a "Sign in with Oidc" button. With the Nextcloud ExApp, WeKan runs as an external app inside Nextcloud (AppAPI), and the Nextcloud user is signed in to WeKan automatically, with no WeKan sign-in page at all.

Read more

How to use it

OAuth2 login

  1. In Nextcloud open https://your.nextcloud/index.php/settings/admin/security and add an OAuth 2.0 client. Use https://your.wekan/_oauth/oidc (your WeKan ROOT_URL followed by /_oauth/oidc) as the redirect URI. Write down the client identifier and the secret.

  2. Set WeKan's environment (or Admin Panel / People / OAuth2):

    OAUTH2_ENABLED=true
    OAUTH2_CLIENT_ID=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
    OAUTH2_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    OAUTH2_SERVER_URL=https://your-nextcloud.tld
    OAUTH2_AUTH_ENDPOINT=/index.php/apps/oauth2/authorize
    OAUTH2_USERINFO_ENDPOINT=/ocs/v2.php/cloud/user?format=json
    OAUTH2_TOKEN_ENDPOINT=/index.php/apps/oauth2/api/v1/token
    OAUTH2_ID_MAP=id
    OAUTH2_USERNAME_MAP=id
    OAUTH2_FULLNAME_MAP=display-name
    OAUTH2_EMAIL_MAP=email
    

    The same lines are commented out under ==== OAUTH2 Nextcloud ==== in docker-compose.yml.

  3. Restart WeKan (or save in the Admin Panel) and click Sign in with Oidc on the sign-in page.

Users of one Nextcloud often share no email domain; give every new OAuth2 account an organization with OAUTH2_DEFAULT_ORGANIZATION (see OAuth2).

Nextcloud ExApp

  1. Install the WeKan external app in Nextcloud 32-35 with a HaRP deploy daemon, as described in WeKan for Nextcloud.
  2. Set NEXTCLOUD_ADMIN_USERS to a JSON array of the exact Nextcloud user ids who are WeKan administrators, for example ["admin"].
  3. Open WeKan from Nextcloud. The Nextcloud user is signed in.

How the numbers are calculated

Nextcloud login has no numbers of its own. The ExApp identity it accepts is limited: the signed identity payload is at most 4096 characters, the signature is 64 hex characters (HMAC-SHA-256), and a user id is 1-255 characters without control characters. The WeKan user id is nc- followed by the SHA-256 of the Nextcloud URL and user id (server/lib/nextcloudIdentity.js).

How it works in WeKan

OAuth2. Nextcloud's user info answer is wrapped in ocs.data; packages/wekan-oidc/oidc_server.js unwraps it ("Nextcloud hack"), and the rest is the generic OAuth2 login.

ExApp, only when NEXTCLOUD_EXAPP=true:

Commits