diff --git a/CHANGELOG.md b/CHANGELOG.md index 14fdf7e9ca2..eaa672390b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ ownCloud admins and users. ## Summary +* Bugfix - Token request with Bearer returns error: [#4080](https://github.com/owncloud/android/issues/4080) * Bugfix - Side menu collapses info in landscape: [#4513](https://github.com/owncloud/android/issues/4513) * Bugfix - Content in Spaces not shown from third-party apps: [#4522](https://github.com/owncloud/android/issues/4522) * Bugfix - Add bottom margin for used quota in account dialog: [#4566](https://github.com/owncloud/android/issues/4566) @@ -50,6 +51,16 @@ ownCloud admins and users. ## Details +* Bugfix - Token request with Bearer returns error: [#4080](https://github.com/owncloud/android/issues/4080) + + A new condition has been added into the network client to check if the network + request comes from TokenRequestRemoteOperation before setting the authorization + header. This allows users to have more than one logged-in account on the same + server. + + https://github.com/owncloud/android/issues/4080 + https://github.com/owncloud/android/pull/4586 + * Bugfix - Side menu collapses info in landscape: [#4513](https://github.com/owncloud/android/issues/4513) Two empty and visual items have been added to prevent the drawer from collapsing diff --git a/changelog/unreleased/4586 b/changelog/unreleased/4586 new file mode 100644 index 00000000000..39e2e9ec1f7 --- /dev/null +++ b/changelog/unreleased/4586 @@ -0,0 +1,7 @@ +Bugfix: Token request with Bearer returns error + +A new condition has been added into the network client to check if the network request comes from TokenRequestRemoteOperation +before setting the authorization header. This allows users to have more than one logged-in account on the same server. + +https://github.com/owncloud/android/issues/4080 +https://github.com/owncloud/android/pull/4586 diff --git a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java index c8c3ca111f5..d2fd8b2a04a 100644 --- a/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +++ b/owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java @@ -53,6 +53,7 @@ public class OwnCloudClient extends HttpClient { public static final String WEBDAV_FILES_PATH_4_0 = "/remote.php/dav/files/"; public static final String STATUS_PATH = "/status.php"; private static final String WEBDAV_UPLOADS_PATH_4_0 = "/remote.php/dav/uploads/"; + private static final String KONNECT_V1_TOKEN_PATH = "/konnect/v1/token"; private static final int MAX_RETRY_COUNT = 2; private static int sIntanceCounter = 0; @@ -131,7 +132,8 @@ private int saveExecuteHttpMethod(HttpBaseMethod method) throws Exception { method.setRequestHeader(HttpConstants.USER_AGENT_HEADER, SingleSessionManager.getUserAgent()); method.setRequestHeader(HttpConstants.ACCEPT_LANGUAGE_HEADER, Locale.getDefault().getLanguage()); method.setRequestHeader(HttpConstants.ACCEPT_ENCODING_HEADER, HttpConstants.ACCEPT_ENCODING_IDENTITY); - if (mCredentials.getHeaderAuth() != null && !mCredentials.getHeaderAuth().isEmpty()) { + if (mCredentials.getHeaderAuth() != null && !mCredentials.getHeaderAuth().isEmpty() + && !method.getHttpUrl().encodedPath().equals(KONNECT_V1_TOKEN_PATH)) { method.setRequestHeader(AUTHORIZATION_HEADER, mCredentials.getHeaderAuth()); }