Skip to content

Commit

Permalink
Support bearer token for non-webdav requests
Browse files Browse the repository at this point in the history
  • Loading branch information
raboof committed Aug 26, 2023
1 parent d19cded commit 324d081
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Changelog for nextcloud api
- 2023-08-26
- Allow bearer token authentication for non-WebDav requests
- 2022-11-29
- Release 12.0.4, upgraded indirect commons-codec dependency
- Release 12.0.3, upgraded jackson dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ private <R> CompletableFuture<R> executeRequest(final ResponseParser<R> 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", serverConfig.getAuthenticationConfig().getBearerToken());
}
request.setProtocolVersion(HttpVersion.HTTP_1_1);

HttpClientContext context = prepareContext();
Expand Down

0 comments on commit 324d081

Please sign in to comment.