Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-12-10 12:52:38 +0300
committerHannah von Reth <vonreth@kde.org>2021-12-15 12:52:23 +0300
commit4ba37025f4b5ac4a2a6cde6aac7d4a5896cfbac1 (patch)
tree7556af46a6fa71095136786095fe595cef44c941 /src/libsync
parentc8dd64d8fdd8913341b498d4c18da64dadbf8523 (diff)
Restart oauth on error
Fixes: #9196
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/creds/oauth.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsync/creds/oauth.cpp b/src/libsync/creds/oauth.cpp
index e258bca77..e729d63dc 100644
--- a/src/libsync/creds/oauth.cpp
+++ b/src/libsync/creds/oauth.cpp
@@ -224,6 +224,10 @@ void OAuth::startAuthentication()
httpReplyAndClose(socket, QByteArrayLiteral("400 Bad Request"), QByteArrayLiteral("<html><head><title>400 Bad Request</title></head><body><center><h1>400 Bad Request</h1></center></body></html>"));
return;
}
+ // we only allow one response
+ qCDebug(lcOauth) << "Recieved the first valid request, stoping to listen";
+ _server.close();
+
auto job = postTokenRequest({
{ QStringLiteral("grant_type"), QStringLiteral("authorization_code") },
{ QStringLiteral("code"), args.queryItemValue(QStringLiteral("code")) },
@@ -231,10 +235,6 @@ void OAuth::startAuthentication()
{ QStringLiteral("code_verifier"), QString::fromUtf8(_pkceCodeVerifier) },
});
QObject::connect(job, &SimpleNetworkJob::finishedSignal, this, [this, socket](QNetworkReply *reply) {
- qScopeGuard([this] {
- // close the server once we are done here
- _server.close();
- });
const auto jsonData = reply->readAll();
QJsonParseError jsonParseError;
const auto data = QJsonDocument::fromJson(jsonData, &jsonParseError).object().toVariantMap();