You are here

private function GoogleApiClient::getTokenCache in Google API PHP Client 8

Google Token Cache "config cache".

Parameters

string $type: Cache ID.

Return value

array Cache result.

2 calls to GoogleApiClient::getTokenCache()
GoogleApiClient::getAccessTokenWithRefreshToken in src/Service/GoogleApiClient.php
Wrapper for Google_Client::fetchAccessTokenWithRefreshToken.
GoogleApiClient::setAccessToken in src/Service/GoogleApiClient.php
Wrapper for Google_Client::setAccessToken.

File

src/Service/GoogleApiClient.php, line 174

Class

GoogleApiClient
Class Google API Client Service.

Namespace

Drupal\google_api_client\Service

Code

private function getTokenCache($type) {

  // Check tokens in config "cache".
  if ($cache = $this->configTokens
    ->get($type)) {
    $response = unserialize($cache);

    // Only validate if there are valid access tokens
    // Or if we have refresh token lookup.
    if ($type == 'google_access_token' && isset($response['access_token']) || $type == 'google_refresh_token') {
      return $response;
    }
  }
  return [];
}