Skip to content

Commit

Permalink
Cabinet: added some debugging output
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisBirkholz committed Dec 30, 2018
1 parent af5a6b1 commit 5e7f09c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,21 @@ final public function refreshConnection() : bool

// Refresh the token if it's expired.
if ($client->isAccessTokenExpired()) {
$this->logger && $this->logger->debug(\sprintf('%s: refreshing GDrive access token', __FUNCTION__), $client->getAccessToken());

$oldDefer = $client->shouldDefer();
$client->setDefer(false);
$client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
$client->setDefer($oldDefer);

$this->logger && $this->logger->debug(\sprintf('%s: received new GDrive access token', __FUNCTION__), $client->getAccessToken());
$this->config['access_token'] = $client->getAccessToken();

\file_put_contents($this->configDir . \DIRECTORY_SEPARATOR . self::CONFIG_FILE, \json_encode($this->config, \JSON_PRETTY_PRINT));

return true;
} else {
$this->logger && $this->logger->debug(\sprintf('%s: GDrive access token still valid', __FUNCTION__), $client->getAccessToken());
return false;
}
}
Expand Down

0 comments on commit 5e7f09c

Please sign in to comment.