Browse files

Fixed sending signed requests with the query parameters in the EOAuth…

…Service.
  • Loading branch information...
1 parent 0e8066c commit b6b8f424a56354be9ab389df566b6498159dcefd @Nodge committed Jun 8, 2012
Showing with 9 additions and 7 deletions.
  1. +1 −0 CHANGELOG.md
  2. +8 −7 EOAuthService.php
View
1 CHANGELOG.md
@@ -5,6 +5,7 @@ Yii EAuth Change Log
* Added optional headers in EOAuthServiceBase::initRequest().
* Added LinkedIn OAuth provider.
* Added GitHub OAuth provider.
+* Fixed sending signed requests with the query parameters in the EOAuthService.
### Version 1.1.7 (30.03.2012)
* Fixed issue #11. Twitter must authorize user everytime they login.
View
15 EOAuthService.php
@@ -97,10 +97,6 @@ protected function getAccessToken() {
protected function initRequest($url, $options = array()) {
$ch = parent::initRequest($url, $options);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
- if (isset($options['data'])) {
- $data_str = http_build_query($options['data']);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml","SOAPAction: \"/soap/action/query\"", "Content-length: ".strlen($data_str)));
- }
return $ch;
}
@@ -120,10 +116,15 @@ public function makeSignedRequest($url, $options = array(), $parseJson = true) {
$signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
$token = $this->getAccessToken();
- $request = OAuthRequest::from_consumer_and_token($consumer, $token, isset($options['data']) ? 'POST' : 'GET', $url);
+ $query = null;
+ if (isset($options['query'])) {
+ $query = $options['query'];
+ unset($options['query']);
+ }
+
+ $request = OAuthRequest::from_consumer_and_token($consumer, $token, isset($options['data']) ? 'POST' : 'GET', $url, $query);
$request->sign_request($signatureMethod, $consumer, $token);
- $url = $request->to_url();
- return $this->makeRequest($url, $options, $parseJson);
+ return $this->makeRequest($request->to_url(), $options, $parseJson);
}
}

0 comments on commit b6b8f42

Please sign in to comment.