NextCloud on illumos distro with php 8.1

It’s my first installation on this system. Web interface works fine, LDAP is enabled and connected. I can access with my LDAP users.
I cannot use any desktop or mobile client because they always end up saying that access was denied by the server as explained below.
The installation is bare, a nextcloud folder inside htdocs contains the application, and a simple php-fpm directive is pushing every php request to php-fpm 8.1.
I find no error log under php-fpm logs.

Nextcloud version : 25.0.3
Operating system and version : XStreamOS / illumos
Apache or nginx version : Apache 2.4.54
PHP version : 8.1.14

The issue you are facing: cannot use desktop or mobile client

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. Run Desktop Client first access
  2. Type my server URL
  3. Accept self-signed certificate
  4. Access via browser
  5. Grant access to desktop client
  6. Site says account is connected and to get back to the client
  7. Client says the access was denied by the server

The output of your Nextcloud log in Admin > Logging:

[index] Error: Exception: Argument 1 passed to OC\Core\Controller\ClientFlowLoginV2Controller::grantPage() must be of the type string, null given, called in /server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 225 in file '/server/var/apache/htdocs/nextcloud/core/Controller/ClientFlowLoginV2Controller.php' line 152 at <<closure>>

0. /server/var/apache/htdocs/nextcloud/lib/private/AppFramework/App.php line 172
   OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Controll ... {}, "grantPage")
1. /server/var/apache/htdocs/nextcloud/lib/private/Route/Router.php line 298
   OC\AppFramework\App::main("OC\\Core\\Contr ... r", "grantPage", OC\AppFramework\ ... {}, ["core.ClientFlowLoginV2.grantPage"])
2. /server/var/apache/htdocs/nextcloud/lib/base.php line 1047
   OC\Route\Router->match("/login/v2/grant")
3. /server/var/apache/htdocs/nextcloud/index.php line 36
   OC::handleRequest()

GET /nextcloud/index.php/login/v2/grant?
from 185.149.35.121 by 6c7053ba-65f5-1032-82cf-a162703357eb at 2023-02-09T10:06:02+00:00

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

$CONFIG = array (
  'instanceid' => 'ocgy5h49p3h9',
  'passwordsalt' => '****',
  'secret' => '****',
  'trusted_domains' =>
  array (
    0 => '****',
  ),
  'datadirectory' => '/server/var/apache/htdocs/nextcloud/data',
  'dbtype' => 'pgsql',
  'version' => '25.0.3.2',
  'overwrite.cli.url' => '****',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '****',
  'dbpassword' => '****',
  'installed' => true,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'logfile' => '/server/var/apache/htdocs/nextcloud/nextcloud.log',
  'trusted_proxies' =>
   array (
     0 => '****',
     1 => '127.0.0.1',
   ),
);

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

NONE

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.

{"reqId":"mUybERubPZ2uMHngG4GV","level":3,"time":"2023-02-09T10:06:02+00:00","remoteAddr":"185.149.35.121","user":"6c7053ba-65f5-1032-82cf-a162703357eb","app":"index","method":"GET","url":"/nextcloud/index.php/login/v2/grant?","message":"Argument 1 passed to OC\\Core\\Controller\\ClientFlowLoginV2Controller::grantPage() must be of the type string, null given, called in /server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 225 in file '/server/var/apache/htdocs/nextcloud/core/Controller/ClientFlowLoginV2Controller.php' line 152","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36","version":"25.0.3.2","exception":{"Exception":"Exception","Message":"Argument 1 passed to OC\\Core\\Controller\\ClientFlowLoginV2Controller::grantPage() must be of the type string, null given, called in /server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 225 in file '/server/var/apache/htdocs/nextcloud/core/Controller/ClientFlowLoginV2Controller.php' line 152","Code":0,"Trace":[{"file":"/server/var/apache/htdocs/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\ClientFlowLoginV2Controller"},"grantPage"]},{"file":"/server/var/apache/htdocs/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\ClientFlowLoginV2Controller","grantPage",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["core.ClientFlowLoginV2.grantPage"]]},{"file":"/server/var/apache/htdocs/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/login/v2/grant"]},{"file":"/server/var/apache/htdocs/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":165,"Previous":{"Exception":"TypeError","Message":"Argument 1 passed to OC\\Core\\Controller\\ClientFlowLoginV2Controller::grantPage() must be of the type string, null given, called in /server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php on line 225","Code":0,"Trace":[{"file":"/server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"grantPage","class":"OC\\Core\\Controller\\ClientFlowLoginV2Controller","type":"->","args":[null]},{"file":"/server/var/apache/htdocs/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\ClientFlowLoginV2Controller"},"grantPage"]},{"file":"/server/var/apache/htdocs/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\ClientFlowLoginV2Controller"},"grantPage"]},{"file":"/server/var/apache/htdocs/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\ClientFlowLoginV2Controller","grantPage",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["core.ClientFlowLoginV2.grantPage"]]},{"file":"/server/var/apache/htdocs/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/login/v2/grant"]},{"file":"/server/var/apache/htdocs/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/server/var/apache/htdocs/nextcloud/core/Controller/ClientFlowLoginV2Controller.php","Line":152},"CustomMessage":"--"}}