Skip to content

Commit

Permalink
Code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 1, 2024
1 parent 4a9d039 commit 56d4a30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions htdocs/core/class/CMailFile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1139,13 +1139,14 @@ public function sendfile()
$oauthname = explode('-', $OAUTH_SERVICENAME);
// ex service is Google-Emails we need only the first part Google
$apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array());
// We have to save the token because Google give it only once

// We have to save the refresh token because Google give it only once
$refreshtoken = $tokenobj->getRefreshToken();

if ($apiService instanceof OAuth\OAuth2\Service\AbstractService || $apiService instanceof OAuth\OAuth1\Service\AbstractService) {
// ServiceInterface does not provide refreshAccessToekn, AbstractService does
$tokenobj = $apiService->refreshAccessToken($tokenobj);
$tokenobj->setRefreshToken($refreshtoken);
$tokenobj->setRefreshToken($refreshtoken); // Restore the refresh token
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
}

Expand Down

0 comments on commit 56d4a30

Please sign in to comment.