swatantra / oauth-php

Automatically exported from code.google.com/p/oauth-php
MIT License
0 stars 0 forks source link

twoleggedtwitter example fails with incorrect $params #62

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. take r142 /example/client/twoleggedtwitter.php
2. fill in valid KEY and SECRET
3. add echo $result['body'] @ line 61
4. run example

What is the expected output? What do you see instead?
Expected: json string of Twitter Public Timeline
Actual: 401 error: invalid  expired token

What version of the product are you using? On what operating system?
r142 on PHP 5.2.13

Please provide any additional information below.
on line 56 the params are determined based on the body of the first request and 
passed to the second request object:

$params = explode('&',$result['body']);
$request = new OAuthRequester(TWITTER_PUBLIC_TIMELINE_API, 'GET', $params);

Wwhen an array is passed, it is considered a key => value array of the params 
(OAuthRequestSigner.php @ line 61). When a string is passed it is parsed for 
parameters (starting in OAuthRequst.php @ line 140)

The explode results in an index-based array with key.'='.value as the value.

Probable solution would be either:
change line 56 in something that results in a key => value array of params.
change line 56 in $params = $result['body']; (this works for me, however, I'm 
not sure about urlencode issues that need to be considered)

Original issue reported on code.google.com by ontr...@gmail.com on 4 Sep 2010 at 11:28

GoogleCodeExporter commented 8 years ago
It seems this was fixed in r150, but I failed to notice because of lack of an 
issue ticket.

Original comment by ontr...@gmail.com on 4 Sep 2010 at 11:32

GoogleCodeExporter commented 8 years ago
Fixed and I'm posting a new release.

Original comment by brunobg%...@gtempaccount.com on 10 Sep 2010 at 7:05