How to enable Auto new users creation for SSO

Nextcloud version (eg, 20.0.5): 25.0.2
Operating system and version (eg, Ubuntu 20.04): replace me
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): 8.1.14

The issue you are facing:

UI Error when I’m using SSO service (Authelia) to connecte with a user existing in Authelia but not in Nextcloud.
I use the Nextcloud application : OpenID Connect Login

Erreur
Auto creating new users is disabled

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. Configure nextcloud with the following config.php
  2. install Applications OpenID Connect Login
  3. One login page click : log in with Authelia
  4. Connect with the Authelia use
  5. Error appear

The output of your Nextcloud log in Admin > Logging:

Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:45:09+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:45:09+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:44:58+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:44:58+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:44:49+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:44:49+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:44:49+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:44:49+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:43:05+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:43:05+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:43:05+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:43:05+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:39:48+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:39:48+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:39:48+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:39:48+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:34:08+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:34:08+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:26:50+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:26:50+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:11:44+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:11:44+0100
Fatal	no app in context	Error: Failed opening required 'assets/login.php' (include_path='/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps')		2023-01-07T20:11:10+0100
Erreur	PHP	Error: require(assets/login.php): Failed to open stream: No such file or directory at /var/www/html/custom_apps/oidc_login/lib/AppInfo/Application.php#162		2023-01-07T20:11:10+0100
Avertissement	core	Renewing session token failed		2023-01-07T20:11:10+0100
Erreur	index	RuntimeException: Could not get appdata folder for preview		2023-01-07T15:17:54+0100
Erreur	index	RuntimeException: Could not get appdata folder for preview		2023-01-07T15:17:54+0100
Erreur	no app in context	OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin' for key 'user_status_uid_ix'		2023-01-07T15:17:53+0100
Erreur	PHP	Error: exif_read_data(): File not supported at /var/www/html/lib/private/Metadata/Provider/ExifProvider.php#59		2023-01-07T15:16:33+0100
Avertissement	no app in context	Could not detect any host in https:///data/htaccesstest.txt		2023-01-07T15:16:22+0100
Avertissement	no app in context	Could not detect any host in http:///data/htaccesstest.txt		2023-01-07T15:16:22+0100
Avertissement	no app in context	Could not detect any host in https:///data/htaccesstest.txt		2023-01-07T15:15:37+0100
Avertissement	no app in context	Could not detect any host in http:///data/htaccesstest.txt

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'ocwoxm2lg32n',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    1 => 'cloud.example.com',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '25.0.2.3',
  'overwriteprotocol' => 'https',
  'overwrite.cli.url' => '***',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '***',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '***',
  'installed' => true,
  'loglevel' => 2,
  'maintenance' => false,
  'config_is_read_only' => true,
  
  'allow_user_to_change_display_name' => false,
  'lost_password_link' => 'disabled',
  'oidc_login_provider_url' => 'https://auth.example.com',
  'oidc_login_client_id' => 'nextcloud',
  'oidc_login_client_secret' => '***',
  'oidc_login_auto_redirect' => false,
  'oidc_login_end_session_redirect' => false,
  'oidc_login_button_text' => 'Log in with Authelia',
  'oidc_login_hide_password_form' => false,
  'oidc_login_use_id_token' => true,
  'oidc_login_attributes' => array (
      'id' => 'preferred_username',
      'name' => 'name',
      'mail' => 'email',
      'groups' => 'groups',
  ),
  'oidc_login_default_group' => 'oidc',
  'oidc_login_use_external_storage' => false,
  'oidc_login_scope' => 'openid profile email groups',
  'oidc_login_proxy_ldap' => false,
  'oidc_login_disable_registration' => true,
  'oidc_login_redir_fallback' => false,
  'oidc_login_alt_login_page' => 'assets/login.php',
  'oidc_login_tls_verify' => true,
  'oidc_create_groups' => false,
  'oidc_login_webdav_enabled' => false,
  'oidc_login_password_authentication' => false,
  'oidc_login_public_key_caching_time' => 86400,
  'oidc_login_min_time_between_jwks_requests' => 10,
  'oidc_login_well_known_caching_time' => 86400,
  'oidc_login_update_avatar' => false,
);

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

PASTE HERE


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

PASTE HERE

hello @mammoth welcome to the forum :handshake:

Please describe what did you try to fix the issue?

In my eyes the error is clear and reading the docs (of the OpenID login app) will provide an answer…

Hello thanks for your response. I should have looked at the the official documentation first.

The answer is to set this option on false:

<?php
$CONFIG = array (
   // Disable creation of users new to Nextcloud from OIDC login.
    // A user may be known to the IdP but not (yet) known to Nextcloud.
    // This setting controls what to do in this case.
    // - 'true' (default): if the user authenticates to the IdP but is not known to Nextcloud,
    //     then they will be returned to the login screen and not allowed entry;
    // - 'false': if the user authenticates but is not yet known to Nextcloud,
    //     then the user will be automatically created; note that with this setting,
    //     you will be allowing (or relying on) a third-party (the IdP) to create new users
    'oidc_login_disable_registration' => true,
);
1 Like