diff --git a/src/main/java/org/aarboard/nextcloud/api/utils/ConnectorCommon.java b/src/main/java/org/aarboard/nextcloud/api/utils/ConnectorCommon.java index 1a50850..d7378ce 100644 --- a/src/main/java/org/aarboard/nextcloud/api/utils/ConnectorCommon.java +++ b/src/main/java/org/aarboard/nextcloud/api/utils/ConnectorCommon.java @@ -154,6 +154,9 @@ private CompletableFuture executeRequest(final ResponseParser parser, // https://docs.nextcloud.com/server/14/developer_manual/core/ocs-share-api.html request.addHeader("OCS-APIRequest", "true"); request.addHeader("Content-Type", "application/x-www-form-urlencoded"); + if (serverConfig.getAuthenticationConfig().usesBearerTokenAuthentication()) { + request.addHeader("Authorization", "Bearer " + serverConfig.getAuthenticationConfig().getBearerToken()); + } request.setProtocolVersion(HttpVersion.HTTP_1_1); HttpClientContext context = prepareContext();