]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Only use basic authentication if needed
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Fri, 8 Oct 2021 15:00:10 +0000 (17:00 +0200)
committerFelix Weilbach <felix.weilbach@nextcloud.com>
Mon, 18 Oct 2021 10:20:20 +0000 (12:20 +0200)
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
src/libsync/networkjobs.cpp

index 2800af0d6514c7a1f4945de23a2a68bb3d93735d..96739c906bdc3553c59ca36d55b04c09f4781ba0 100644 (file)
@@ -966,7 +966,10 @@ void DetermineAuthTypeJob::start()
     oldFlowRequired->setIgnoreCredentialFailure(true);
 
     connect(get, &SimpleNetworkJob::finishedSignal, this, [this, get]() {
-        if (get->reply()->error() == QNetworkReply::AuthenticationRequiredError) {
+        const auto reply = get->reply();
+        const auto wwwAuthenticateHeader = reply->rawHeader("WWW-Authenticate");
+        if (reply->error() == QNetworkReply::AuthenticationRequiredError
+            && (wwwAuthenticateHeader.startsWith("Basic") || wwwAuthenticateHeader.startsWith("Bearer"))) {
             _resultGet = Basic;
         } else {
             _resultGet = LoginFlowV2;