nextcloud / nextcloud/user_oidc

Unable to use a custom attribute as uid

Open
#1,174 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: normal question
Dominant language
PHP
Stars
181
Forks
60
Avg merge
7h 34m
Merged PRs (30d)
26

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce
  1. Configure an OIDC provider to expose a members unique ID as "memberid"
  2. In "Attribute Mapping / User ID mapping" set "memberid"
  3. Try to log in with the user
Expected behaviour

I want to use the memberid as "uid" in nextcloud.
The memberid is a 9 digit number which is exposed in the standard claims delivered by the OIDC IDP.

Actual behaviour

When selecting "login with idp" I get redirected for log in and end up with "Failed to provision the user".
I can see the attribute being part of "Parsed the JWT payload:" in the debug log.
It works when I change "memberid" to "preferred_username".

Server configuration

Web server: Apache

Database: Maria

PHP version: 8.1/8.2/8.3

Nextcloud version: 30.0.4 (also tested 30.0.12 on Hetzner Storage Box, same behaviour but no access to logs)

List of activated apps ``Enabled: - activity: 3.0.0 - app_api: 4.0.3 - bruteforcesettings: 3.0.0 - calendar: 5.0.8 - circles: 30.0.0 - cloud_federation_api: 1.13.0 - comments: 1.20.1 - contacts: 6.1.2 - contactsinteraction: 1.11.0 - dashboard: 7.10.0 - dav: 1.31.1 - federatedfilesharing: 1.20.0 - federation: 1.20.0 - files: 2.2.0 - files_downloadlimit: 3.0.0 - files_external: 1.22.0 - files_pdfviewer: 3.0.0 - files_reminders: 1.3.0 - files_sharing: 1.22.0 - files_trashbin: 1.20.1 - files_versions: 1.23.0 - firstrunwizard: 3.0.0 - logreader: 3.0.0 - lookup_server_connector: 1.18.0 - nextcloud_announcements: 2.0.0 - notifications: 3.0.0 - oauth2: 1.18.1 - password_policy: 2.0.0 - photos: 3.0.2 - privacy: 2.0.0 - provisioning_api: 1.20.0 - recommendations: 3.0.0 - related_resources: 1.5.0 - serverinfo: 2.0.0 - settings: 1.13.0 - sharebymail: 1.20.0 - sociallogin: 5.7.0 - support: 2.0.0 - survey_client: 2.0.0 - systemtags: 1.20.0 - tasks: 0.16.1 - text: 4.1.0 - theming: 2.5.0 - twofactor_backupcodes: 1.19.0 - updatenotification: 1.20.0 - user_oidc: 7.3.1 - user_status: 1.10.0 - viewer: 3.0.0 - weather_status: 1.10.0 - webhook_listeners: 1.1.0-dev - workflowengine: 2.12.0 Disabled: - admin_audit: 1.20.0 - encryption: 2.18.0 - files_rightclick: 0.15.1 (installed 1.6.0) - suspicious_login: 8.0.0 - twofactor_nextcloud_notification: 4.0.0 - twofactor_totp: 12.0.0-dev - user_ldap: 1.21.0 ```
Nextcloud configuration
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "owncloud.example.com,
            "nextcloud.example.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/owncloud.example.com",
        "dbtype": "mysql",
        "version": "30.0.4.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "theme": "",
        "maintenance": false,
        "forcessl": true,
        "loglevel": 0,
        "trashbin_retention_obligation": "14,60",
        "mysql.utf8mb4": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587"
    }
}
Browser

Problem is not browser related

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the user_oidc app's attribute-mapping and user-provisioning flow, using the debug log entry “Parsed the JWT payload” and the “Failed to provision the user” path. Reproduce with a numeric memberid mapped to uid, compare it with preferred_username, and trace where the custom claim is rejected. Done means a mapped nine-digit memberid provisions the Nextcloud user successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.