Skip to content

Commit

Permalink
OAuth2: Try to refresh the token even if the credentials weren't ready.
Browse files Browse the repository at this point in the history
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
#6522 (comment)
  • Loading branch information
ogoffart committed Jun 13, 2018
1 parent 9e26b0f commit 5ca0548
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui/accountstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ void AccountState::slotInvalidCredentials()

if (account()->credentials()->ready()) {
account()->credentials()->invalidateToken();
if (auto creds = qobject_cast<HttpCredentials *>(account()->credentials())) {
if (creds->refreshAccessToken())
return;
}
}
if (auto creds = qobject_cast<HttpCredentials *>(account()->credentials())) {
if (creds->refreshAccessToken())
return;
}
account()->credentials()->askFromUser();
}
Expand Down

0 comments on commit 5ca0548

Please sign in to comment.