/**
  * @inheritdoc
  */
 public function getTokenFromCode($code, $redirectUri, array $inputData = array())
 {
     $browser = $this->browserManager->getBrowser();
     $params = $this->buildCodeParams($code, $redirectUri);
     $response = $browser->get($this->options['token_url'] . '?' . http_build_query($params));
     return $this->handleCodeResponse($response);
 }
 /**
  * @param string $endpoint
  * @param array $params
  * @param string $role
  * @return RoleTokenStorage
  * @throws BadAuthentificationException
  */
 public function authentificate($endpoint, array $params, $grant)
 {
     $browser = $this->browserManager->getBrowser();
     $params['grant_type'] = $grant;
     $response = $browser->get($endpoint . '?' . http_build_query($params));
     try {
         $data = $this->handleResponse($response);
     } catch (BadAuthentificationException $e) {
         throw $e;
     }
     return ['accessToken' => $data['access_token'], 'expiresIn' => $data['expires_in'], 'refreshToken' => $data['refresh_token']];
 }
 public function test()
 {
     $browserManager = new BrowserManager();
     $this->assertTrue($browserManager->getBrowser() instanceof Browser);
 }