How to troubleshoot Sabre Exception NotAuthenticated?

I do not understand how am I supposed to troubleshoot this error, I am able to connect to NextCloud using the same username/password, but Sabre claims I am not authenticated when using it with the curl command. (it doesn’t say the user or password is invalid)

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com 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:

example

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

longer
example
here

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, 20.0.5): 24.0.2
Operating system and version (eg, Ubuntu 20.04): unspecified by host
Apache or nginx version (eg, Apache 2.4.25): unspecified by host
PHP version (eg, 7.4): 7.4

The issue you are facing:

<?xml version="1.0" encoding="utf-8"?>

<d:error xmlns:d=“DAV:” xmlns:s=“http://sabredav.org/ns”>
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>No public access to this resource., No ‘Authorization: Bearer’ header found. Either the client didn’t send one, or the server is mis-configured, No ‘Authorization: Basic’ header found. Either the client didn’t send one, or the server is misconfigured</s:message>
</d:error>

Is this the first time you’ve seen this error? (Y/N):
Y
Steps to replicate it:

  1. curl --silent --request PROPFIND --header ‘Content-Type: text/xml’ --header ‘Depth: 0’ --data ‘<d:propfind xmlns:d=“DAV:”><d:prop> <d:current-user-principal /></d:prop></d:propfind>’ --user ‘Username:Passwordwithspecialchars’ “https://xxx.xxx.xxx.xxx/remote.php/dav/

The output of your Nextcloud log in Admin > Logging:

Empty

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

<?php
$CONFIG = array (
  'instanceid' => 'ocvh4sxxx',
  'passwordsalt' => 'WO0H2adJ8HUX21xxx',
  'secret' => 'aTCb8JFgi9v7B/JRrMTy36sxxx',
  'trusted_domains' => 
  array (
    0 => 'xxx.xxx.xxx.xxx',
  ),
  'datadirectory' => '/home/xxx/xxx.xxx.xxx.xxx/data',
  'dbtype' => 'sqlite3',
  'version' => '24.0.2.1',
  'overwrite.cli.url' => 'https://xxx.xxx.xxx.xxx',
  'installed' => true,
);

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

Empty

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.

nextcloud.log is empty