Skip to content

Commit

Permalink
Only use basic authentication if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Weilbach authored and mgallien committed Oct 15, 2021
1 parent 3b1f195 commit 35979ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libsync/networkjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 35979ae

Please sign in to comment.