#include <QJsonDocument>
#include "theme.h"
-
namespace OCC {
+Q_LOGGING_CATEGORY(lcOauth, "sync.credentials.oauth", QtInfoMsg)
+
OAuth::~OAuth()
{
}
if (reply->error() != QNetworkReply::NoError || jsonParseError.error != QJsonParseError::NoError
|| json.isEmpty() || refreshToken.isEmpty() || accessToken.isEmpty()
|| json["token_type"].toString() != QLatin1String("Bearer")) {
- qDebug() << "Error when getting the accessToken" << reply->error() << json << jsonParseError.errorString();
+ qCWarning(lcOauth) << "Error when getting the accessToken" << reply->error() << json << jsonParseError.errorString();
emit result(Error);
return;
}
}
if (_reply->error() != QNetworkReply::NoError) {
- qCWarning(lcNetworkJob) << _reply->error() << errorString()
- << _reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
- if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) {
- qCWarning(lcNetworkJob) << _reply->rawHeader("Proxy-Authenticate");
+ if (!_ignoreCredentialFailure || _reply->error() != QNetworkReply::AuthenticationRequiredError) {
+ qCWarning(lcNetworkJob) << _reply->error() << errorString()
+ << _reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
+ if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) {
+ qCWarning(lcNetworkJob) << _reply->rawHeader("Proxy-Authenticate");
+ }
}
emit networkError(_reply);
}
addSettingsToJob(_account, job);
job->setInsecureFallback(false);
job->setKey(kck);
- qCDebug(lcHttpCredentials) << "-------- ----->" << _clientSslCertificate << _clientSslKey;
connect(job, SIGNAL(finished(QKeychain::Job *)), SLOT(slotReadClientCertPEMJobDone(QKeychain::Job *)));
job->start();
QString accessToken = json["access_token"].toString();
if (reply->error() != QNetworkReply::NoError || jsonParseError.error != QJsonParseError::NoError || json.isEmpty()) {
// Network error maybe?
- qDebug() << "Error while refreshing the token" << reply->errorString() << jsonData << jsonParseError.errorString();
+ qCWarning(lcHttpCredentials) << "Error while refreshing the token" << reply->errorString() << jsonData << jsonParseError.errorString();
} else if (accessToken.isEmpty()) {
// The token is no longer valid.
- qDebug() << "Expired refresh token. Logging out";
+ qCDebug(lcHttpCredentials) << "Expired refresh token. Logging out";
_refreshToken.clear();
} else {
_ready = true;