mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 00:10:00 +02:00
Merge pull request #1093 from JulianGro/fix-login-error
Fix login failure handling and improve logging.
This commit is contained in:
commit
b69ab5a157
2 changed files with 10 additions and 7 deletions
|
@ -4,6 +4,7 @@
|
||||||
// Created by Wayne Chen on 10/18/18
|
// Created by Wayne Chen on 10/18/18
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
// Copyright 2020 Vircadia contributors.
|
// Copyright 2020 Vircadia contributors.
|
||||||
|
// Copyright 2024 Overte e.V.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -377,13 +378,13 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHandleLoginCompleted(): {
|
function onHandleLoginCompleted() {
|
||||||
console.log("Login Succeeded");
|
console.log("Login Succeeded");
|
||||||
loggingInBody.loadingSuccess();
|
loggingInBody.loadingSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onHandleLoginFailed() {
|
function onHandleLoginFailed() {
|
||||||
console.log("Login Failed")
|
console.log("Login Failed");
|
||||||
loggingInSpinner.visible = false;
|
loggingInSpinner.visible = false;
|
||||||
loggingInGlyph.visible = false;
|
loggingInGlyph.visible = false;
|
||||||
var errorString = "";
|
var errorString = "";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
// Created by Stephen Birarda on 2/18/2014.
|
// Created by Stephen Birarda on 2/18/2014.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
// Copyright 2023 Overte e.V.
|
// Copyright 2023-2024 Overte e.V.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
@ -696,7 +696,8 @@ void AccountManager::setAccessTokens(const QString& response) {
|
||||||
if (!rootObject.contains("access_token") || !rootObject.contains("expires_in")
|
if (!rootObject.contains("access_token") || !rootObject.contains("expires_in")
|
||||||
|| !rootObject.contains("token_type")) {
|
|| !rootObject.contains("token_type")) {
|
||||||
// TODO: error handling - malformed token response
|
// TODO: error handling - malformed token response
|
||||||
qCDebug(networking) << "Received a response for password grant that is missing one or more expected values.";
|
qCWarning(networking) << "Error setting access token. Received a response for password grant that is missing one or more expected values.";
|
||||||
|
qCWarning(networking) << "Response:" << QJsonDocument(rootObject).toJson(QJsonDocument::Compact);
|
||||||
} else {
|
} else {
|
||||||
// clear the path from the response URL so we have the right root URL for this access token
|
// clear the path from the response URL so we have the right root URL for this access token
|
||||||
QUrl rootURL = rootObject.contains("url") ? rootObject["url"].toString() : _authURL;
|
QUrl rootURL = rootObject.contains("url") ? rootObject["url"].toString() : _authURL;
|
||||||
|
@ -714,7 +715,7 @@ void AccountManager::setAccessTokens(const QString& response) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
qCDebug(networking) << "Error in response for password grant -" << rootObject["error_description"].toString();
|
qCWarning(networking) << "Error in response for password grant -" << rootObject["error"].toString();
|
||||||
emit loginFailed();
|
emit loginFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -731,7 +732,8 @@ void AccountManager::requestAccessTokenFinished() {
|
||||||
if (!rootObject.contains("access_token") || !rootObject.contains("expires_in")
|
if (!rootObject.contains("access_token") || !rootObject.contains("expires_in")
|
||||||
|| !rootObject.contains("token_type")) {
|
|| !rootObject.contains("token_type")) {
|
||||||
// TODO: error handling - malformed token response
|
// TODO: error handling - malformed token response
|
||||||
qCDebug(networking) << "Received a response for password grant that is missing one or more expected values.";
|
qCWarning(networking) << "Error requesting access token. Received a response for password grant that is missing one or more expected values.";
|
||||||
|
qCWarning(networking) << "Response:" << QJsonDocument(rootObject).toJson(QJsonDocument::Compact);
|
||||||
} else {
|
} else {
|
||||||
// clear the path from the response URL so we have the right root URL for this access token
|
// clear the path from the response URL so we have the right root URL for this access token
|
||||||
QUrl rootURL = requestReply->url();
|
QUrl rootURL = requestReply->url();
|
||||||
|
@ -750,7 +752,7 @@ void AccountManager::requestAccessTokenFinished() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: error handling
|
// TODO: error handling
|
||||||
qCDebug(networking) << "Error in response for password grant -" << rootObject["error_description"].toString();
|
qCWarning(networking) << "Error in response for password grant -" << rootObject["error"].toString();
|
||||||
emit loginFailed();
|
emit loginFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue