change(MSAStep): log server errors

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2026-01-29 17:11:30 +05:00
parent 70cbbf5b07
commit 665aa4c546
No known key found for this signature in database
GPG key ID: B77C34313AEE1FFF

View file

@ -81,6 +81,33 @@ class CustomOAuthOobReplyHandler : public QOAuthOobReplyHandler {
disconnect(APPLICATION, &Application::oauthReplyRecieved, this, &QOAuthOobReplyHandler::callbackReceived);
}
QString callback() const override { return BuildConfig.LAUNCHER_APP_BINARY_NAME + "://oauth/microsoft"; }
protected:
void networkReplyFinished(QNetworkReply* reply) override
{
if (reply->error() != QNetworkReply::NoError) {
qWarning() << "OAuth2 request failed:" << reply->readAll();
}
QOAuthOobReplyHandler::networkReplyFinished(reply);
}
};
class LoggingOAuthHttpServerReplyHandler final : public QOAuthHttpServerReplyHandler {
Q_OBJECT
public:
explicit LoggingOAuthHttpServerReplyHandler(QObject* parent = nullptr) : QOAuthHttpServerReplyHandler(parent) {}
protected:
void networkReplyFinished(QNetworkReply* reply) override
{
if (reply->error() != QNetworkReply::NoError) {
qWarning() << "OAuth2 request failed:" << reply->readAll();
}
QOAuthHttpServerReplyHandler::networkReplyFinished(reply);
}
};
MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(silent)
@ -89,7 +116,7 @@ MSAStep::MSAStep(AccountData* data, bool silent) : AuthStep(data), m_silent(sile
if (QCoreApplication::applicationFilePath().startsWith("/tmp/.mount_") || APPLICATION->isPortable() || !isSchemeHandlerRegistered())
{
auto replyHandler = new QOAuthHttpServerReplyHandler(this);
auto replyHandler = new LoggingOAuthHttpServerReplyHandler(this);
replyHandler->setCallbackText(QString(R"XXX(
<noscript>
<meta http-equiv="Refresh" content="0; URL=%1" />