Not able to authenticate external user backend(specifically Keycloak) using Webdav
I am operating on Ubuntu 17.10.
I have configured the NextCloud with the keycloak and the authentication works fine. Accessing the nextcloud server url re-directs me to the keycloak login page and get the authentication working from the keycloak server.
I want to carry out the same authentication via webdav, but I believe the webdav of nextcloud is not supporting this.
I try to CURL with the username and password it authenticates and gives the result.
curl --user admin:password http://172.17.0.1/remote.php/dav/files/admin/Documents
But, if I try the CURL with the bearer token that I have generated using the keycloak then it is not working and I get the response as indicated.
curl -H "Authorization: Bearer <Token>" http://172.17.0.1/remote.php/dav/files/admin/Documents
Response:
<?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: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>
</d:error>
There was already a similar issue at https://github.com/nextcloud/server/issues/5512, although in this issue the user was not using any of the external user backend, as I am using the keycloak server.
I also did hit the webdav url http://172.17.0.1/remote.php/dav/files/admin/Documents, and it gives me the prompt for the basic credentials.
We really need an answer here too, I checked #5512 and the trick to use bearer as password with basic auth doesn't work at all. About .htaccess or any configuration it s not clear
@Cracky5457 Can you please tell me, which external user backend are you using?
We also want to use Keycloak but I tried with MitreOpenId and it doesn't work either, but I think whatever the external OIDC provider that you use, nextcloud just seems to not accept bearer token.
Same here (token from keycloak, Bearer not working, interactive login via kc works, dav urls show basic cred dialog)
We're seeing the same thing here. Local users are fine, SSO based users are not.
Hi , Is there any progress. I am stuck on the same point. Looking for urgent help. I am using nextcloud docker image with tag 19.0.0
Any update guys ? I am too stuck at the same point, having exactly same issue as OP even though I tried all suggestions solutions here Would very helpful if we can get some clarification on how to fix it ! Thanks guys
I have the same issue...trying to connect via the OnlyOffice Android App is not working also Windows Webdav is not working. No idea how to fix this ...
does #23920 fix this for you?
@DanScharon I just need to update to a new version correct? (using docker)
@checkso yes, to any version of either 20.0.2, 19.0.5 or 18.0.11
@DanScharon thanks for your comment but I am actually enable to test the fix in both releases 20.0.2, 19.0.5 due to an issue happening whenever I try to enable the app "OpenID Connect user backend" showing the following error "Column name "oc_user_oidc"."display_name" is NotNull, but has empty string or null as default"

@kabrana That issue recently has been fixed: nextcloud/user_oidc#90.
Does the OpenID Connect user backend app solve this issue? I'm still getting the error shown in the first message when I pass a Keycloak token. The app seems to be completely ignored. It has no documentation too.
Anyone who succeeded?
Edit: the error I am getting is actually the one below, the bearer is received but is incorrect.
<s:message>No public access to this resource., No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, Bearer token was incorrect, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured</s:message>
Is this Issue still valid in NC21.0.3? If not, please close this issue. Thanks! :)
Yes it is. I use openid connect login plugin and created users authenticated with openid connect will not be recognized for WebDAV.
Authentication with OIDC tokens is not possible with the app as of right now. For API access you will need to use a app password from Nextcloud. Feel free to open a feature request for this in https://github.com/nextcloud/user_oidc in order to add support for authentication for OIDC tokens.