Skip to content

Commit

Permalink
google: check client credentials only with Sailfish key provider
Browse files Browse the repository at this point in the history
Accounts not using Sailfish key provider will get their client ID and
secret from the account's AuthData class.
  • Loading branch information
mardy committed Sep 14, 2021
1 parent 51c0061 commit 42bde6c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/google/googledatatypesyncadaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void GoogleDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountI
return;
}

#ifdef USE_SAILFISHKEYPROVIDER
if (clientId().isEmpty()) {
SOCIALD_LOG_ERROR("client id couldn't be retrieved for Google account" << accountId);
setStatus(SocialNetworkSyncAdaptor::Error);
Expand All @@ -71,6 +72,7 @@ void GoogleDataTypeSyncAdaptor::sync(const QString &dataTypeString, int accountI
setStatus(SocialNetworkSyncAdaptor::Error);
return;
}
#endif

setStatus(SocialNetworkSyncAdaptor::Busy);
updateDataForAccount(accountId);
Expand Down Expand Up @@ -209,10 +211,16 @@ void GoogleDataTypeSyncAdaptor::signIn(Accounts::Account *account)
{
// Fetch consumer key and secret from keyprovider
int accountId = account->id();
if (!checkAccount(account) || clientId().isEmpty() || clientSecret().isEmpty()) {
if (!checkAccount(account)) {
decrementSemaphore(accountId);
return;
}
#ifdef USE_SAILFISHKEYPROVIDER
if (clientId().isEmpty() || clientSecret().isEmpty()) {
decrementSemaphore(accountId);
return;
}
#endif

// grab out a valid identity for the sync service.
Accounts::Service srv(m_accountManager->service(syncServiceName()));
Expand Down

0 comments on commit 42bde6c

Please sign in to comment.