/** * Performs request to the OAuth API. * @param OAuthToken $accessToken actual access token. * @param string $url absolute API URL. * @param string $method request method. * @param array $params request parameters. * @return array API response. * @throws Exception on failure. */ protected function apiInternal($accessToken, $url, $method, array $params) { $params['oauth_consumer_key'] = $this->consumerKey; $params['oauth_token'] = $accessToken->getToken(); $response = $this->sendSignedRequest($method, $url, $params); return $response; }
/** * * @param \yii\authclient\OAuthToken $accessToken * @param string $url * @param string $method * @param array $params * @param array $headers */ protected function apiInternal($accessToken, $url, $method, array $params, array $headers) { $headers[] = 'Authorization: Bearer ' . $accessToken->getToken(); return $this->sendRequest($method, $url, $params, $headers); }
/** * @depends testSetupParams */ public function testSetupParamsShortcuts() { $oauthToken = new OAuthToken(); $token = 'test_token_value'; $oauthToken->setToken($token); $this->assertEquals($token, $oauthToken->getToken(), 'Unable to setup token!'); $tokenSecret = 'test_token_secret'; $oauthToken->setTokenSecret($tokenSecret); $this->assertEquals($tokenSecret, $oauthToken->getTokenSecret(), 'Unable to setup token secret!'); $tokenExpireDuration = rand(1000, 2000); $oauthToken->setExpireDuration($tokenExpireDuration); $this->assertEquals($tokenExpireDuration, $oauthToken->getExpireDuration(), 'Unable to setup expire duration!'); }
/** * Performs request to the OAuth API. * @param OAuthToken $accessToken actual access token. * @param string $url absolute API URL. * @param string $method request method. * @param array $params request parameters. * @return array API response. * @throws Exception on failure. */ protected function apiInternal($accessToken, $url, $method, array $params) { $params['access_token'] = $accessToken->getToken(); return $this->sendRequest($method, $url, $params); }