From 5ca0548bec9cb2fc1e62bff61cd90f9877e1c9d2 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 13 Jun 2018 15:15:54 +0200 Subject: [PATCH] OAuth2: Try to refresh the token even if the credentials weren't ready. This can happen when the client is started and the internet connection was not enabled. Then we would fetch the credentials, but we would no do the refresh token step (because network is down). So next time we try to connect, we would also not refresh the token because the credentials are not marked as 'ready' Reported in https://github.com/owncloud/client/issues/6522#issuecomment-396845167 --- src/gui/accountstate.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 2f20c57db8b..88b03307f21 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -314,10 +314,10 @@ void AccountState::slotInvalidCredentials() if (account()->credentials()->ready()) { account()->credentials()->invalidateToken(); - if (auto creds = qobject_cast(account()->credentials())) { - if (creds->refreshAccessToken()) - return; - } + } + if (auto creds = qobject_cast(account()->credentials())) { + if (creds->refreshAccessToken()) + return; } account()->credentials()->askFromUser(); }