private function getOauthAccessToken($hostId, array $data) { $data = ProviderAbstract::getExtension($data, Extension\Oauth::NS); $token = isset($data['request_token']) ? $data['request_token'] : null; $verifier = isset($data['verifier']) ? $data['verifier'] : null; if ($hostId > 0 && !empty($token) && !empty($verifier)) { $row = $this->hm->getTable('AmunService\\Core\\Host')->select(array('consumerKey', 'consumerSecret', 'url'))->where('id', '=', $hostId)->where('status', '=', Host\Record::NORMAL)->getRow(); if (!empty($row)) { $url = $this->discoverOauthAcessUrl(new Url($row['url'])); $oauth = new Oauth($this->http); return $oauth->accessToken($url, $row['consumerKey'], $row['consumerSecret'], $token, '', $verifier); } else { throw new Exception('Invalid host id'); } } }