Upload Files to the Nextcloud Server via keycloak authentication with the Access Token

I have configured the authentication of the nextcloud server via keycloak, and accessing the nextcloud server will redirect the webpage to the keycloak realm and get authenticated from the keycloak server.

But, I want to upload the files via this keycloak authentication, I have tested the Java API at the link https://github.com/a-schild/nextcloud-java-api, and this has the implementation to upload the files to the keycloak server with the username and the password explicitly (this works), I want to upload the files by getting the authentication from the keycloak server via token, Can anyone please help me with this?

1 Like

A bit late here, but try using the access_token as password in your webdav client.

In javascript:

//Oauth2.0
var createClient = require(“webdav”);
var client = createClient(
https://nc.example.com/remote.php/webdav”,
“your-user-name”,
access_token
);