Beispiel #1
0
 /**
  * @param $code
  * @return array
  *
  * @throws \Exception
  */
 public function getTokens($code)
 {
     if (!($oauthConfig = $this->client->getConfig("oauth2"))) {
         throw new \Exception('OAuth2 authorisation not registered');
     }
     $tokens = $this->executeCommand('GetAuthToken', array_merge((array) $oauthConfig, array('code' => $code)));
     return $tokens;
 }
Beispiel #2
0
 /**
  * Initializes the HTTP Client
  */
 private function initializeClient()
 {
     $this->client = new GuzzleClient($this->config->getBaseUrl());
     $this->client->setDefaultOption('headers', $this->getHeaders());
     $this->client->getConfig()->set('curl.options', array(CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4));
     if ($this->config->getDebug()) {
         $this->client->addSubscriber(LogPlugin::getDebugPlugin());
     }
 }