/**
  * Acquire a new access token from the server.
  *
  * @return array|null
  */
 protected function acquireAccessToken()
 {
     $accessToken = parent::acquireAccessToken();
     if ($this->cache !== null) {
         $this->cache->put($this->accessToken);
     }
     return $accessToken;
 }
 public function authenticate()
 {
     $params = array('code' => $this->authorizationCode, 'redirect_uri' => $this->redirectUrl, 'client_id' => $this->exactClientId, 'client_secret' => $this->exactClientSecret, 'refresh_token' => $this->refreshToken);
     $oauth2Client = new Client($this->tokenUrl);
     $grantType = new AuthorizationCode($oauth2Client, $params);
     $refreshTokenGrantType = new RefreshToken($oauth2Client, $params);
     $oauth2Plugin = new Oauth2Plugin($grantType, $refreshTokenGrantType);
     if (!empty($this->refreshToken)) {
         $oauth2Plugin->setRefreshToken($this->refreshToken);
     }
     $this->accessToken = $oauth2Plugin->getAccessToken();
     $this->refreshToken = $oauth2Plugin->getRefreshToken();
     $this->client()->addSubscriber($oauth2Plugin);
 }