Sharing of group folder via API and basic auth leads to 404 error

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:


Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2): 17.0.2
Operating system and version (eg, Ubuntu 17.04): Docker image
Apache or nginx version (eg, Apache 2.4.25): it’s in the docker container
PHP version (eg, 7.1): it’s in the docker container

The issue you are facing:

When I try to add a share link to a group folder via the API with basic auth, the request fails with error 404. A GET request works as well as sharing other normal folders of the user via the API. If I send a cookie of a browser session instead of the basic auth string along with the request, the stuff works.

Is this the first time you’ve seen this error? (Y/N): Y
(when you mean compared to other versions; but had not tested it there)

Steps to replicate it:

Get the current shares:

curl -X GET -i -u "admin:mycoolpassword" -H "OCS-APIREQUEST:true"

-> Works like a charm and gives me a 200 OK with the currently active shares.

Add a share link for a group folder with basic auth:

curl -X POST -i -u "admin:mycoolpassword" -H "OCS-APIREQUEST:true" -d "shareType=3" -d "path=/testgroupfolder" -d "permissions=1"


<?xml version="1.0"?>
  <message>Can’t increase permissions of /admin/files/testgroupfolder</message>

Add a share link for a group folder with cookie:

curl -X POST -i -H "OCS-APIREQUEST:true" -H "Cookie: oc2ft4imfqls=3d068f3185055de71408a709cxxxxxxx; oc_sessionPassphrase=reDMqoWPswjr7uYPYOlyv2VILO05JRafzrFqTXJ%2BlOqFbZ4H%2BjBpllD9hTRfKR6KNSN4wEq%2FifxUV0wWAGG%2BqzwA5aqytJJ%2BYlsGwkwhjvg5o3oQO09PKbXXXXXXXXXX; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; nc_username=admin; nc_token=t4NqmrAoOHlQz%2BsrbKLtEsXXXXXXXXXX; nc_session_id=3d068f3185055de71408a7xxxxxxxxxx; __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true" -d "shareType=3" -d "path=/testgroupfolder" -d "permissions=1"


<?xml version="1.0"?>

The output of your Nextcloud log in Admin > Logging:

nothing related

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

$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' => 'myid',
  'passwordsalt' => 'supersalt',
  'secret' => 'supersecret',
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',
  'trusted_proxies' => 
  array (
    0 => '',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => '',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'cooldbpass',
  'installed' => true,
  'mail_from_address' => 'noreply',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'myinternal.intranet',
  'mail_smtphost' => '',
  'mail_smtpport' => '25',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'skeletondirectory' => '',

-> But also tested on another instance with the same version.

The output of your Apache/nginx/system log in /var/log/____:
Nothing in the error logs. Access log:

"POST /ocs/v2.php/apps/files_sharing/api/v1/shares HTTP/1.0" 404 1553 "-" "curl/7.58.0"