Skip to content

Commit

Permalink
Fix saving access token to keychain
Browse files Browse the repository at this point in the history
The timing here changed and without this patch, we're trying to save the access token before we even have it available
  • Loading branch information
TobiasFella committed Nov 10, 2024
1 parent 294d8a5 commit 362a9ad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ void Connection::Private::loginToServer(LoginArgTs&&... loginArgs)
q->callApi<LoginJob>(std::forward<LoginArgTs>(loginArgs)...)
.onResult([this](const LoginJob* loginJob) {
if (loginJob->status().good()) {
saveAccessTokenToKeychain();
completeSetup(loginJob->userId(), true, loginJob->deviceId(),
loginJob->accessToken());
} else
Expand All @@ -315,6 +314,10 @@ void Connection::Private::completeSetup(const QString& mxId, bool newLogin,
<< "from device" << data->deviceId();
connect(qApp, &QCoreApplication::aboutToQuit, q, &Connection::saveState);

if (newLogin) {
saveAccessTokenToKeychain();
}

if (accessToken.has_value()) {
q->loadVersions();
q->loadCapabilities();
Expand Down

0 comments on commit 362a9ad

Please sign in to comment.