Issue #6574
When there is an error in the advanced page, OwncloudAdvancedSetupPage::updateStatus
(and others) call completeChanged(), which is connected to
QWizardPrivate::_q_updateButtonStates which will re-enable the back button from the
last page.
When the user click "back" and re-open the browser, the account's credentials
already have a oauth token set. So the call to the API to get a new token fails
because we use the previous token instead of using the client's secret_id.
Fix this with the HttpCredentials::DontAddCredentialsAttribute.
Now, this is still not working because the session cookies are confusing the
server. So we'll clear the cookies when re-opening the browser
#include <QJsonDocument>
#include "theme.h"
#include "networkjobs.h"
+#include "creds/httpcredentials.h"
namespace OCC {
QString basicAuth = QString("%1:%2").arg(
Theme::instance()->oauthClientId(), Theme::instance()->oauthClientSecret());
req.setRawHeader("Authorization", "Basic " + basicAuth.toUtf8().toBase64());
+ // We just added the Authorization header, don't let HttpCredentialsAccessManager tamper with it
+ req.setAttribute(HttpCredentials::DontAddCredentialsAttribute, true);
auto requestBody = new QBuffer;
QUrlQuery arguments(QString(
if (_ui.errorLabel)
_ui.errorLabel->hide();
+ qobject_cast<OwncloudWizard *>(wizard())->account()->clearCookieJar(); // #6574
+
if (_asyncAuth)
_asyncAuth->openBrowser();
}