simonspa / twitcurl

Automatically exported from code.google.com/p/twitcurl
0 stars 0 forks source link

twitCurl::oAuthRequestToken() Doesn't work #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
eg:
1. twitterObj.setTwitterUsername(username);
2. twitterObj.setTwitterPassword(password);
3. twitterObj.getOAuth().setConsumerKey(consumer_key);
4. twitterObj.getOAuth().setConsumerSecret(consumer_secret);

then twitterObj.oAuthRequestToken(authurl) returns true and authurl
is empty. The problem seems from twitter side since it used to work before. 
Something changed in the way oAuth PIN works ? Maybe they disabled 
authenticating with pins ? I wasn't following their news lately

What is the expected output? What do you see instead?
Expected getting a url to get a pin for access token*, I see an empty url and 
oAuthRequestToken returns true

What version of the product are you using? On what operating system?
Latest just pulled the svn

Original issue reported on code.google.com by q...@0x80.org on 21 Feb 2013 at 9:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
the issue appeared because current twitcurl implementation can't get access 
token. to resolve it u should update libtwitcurl\oauthlib.h:
change oAuthTwitterApiUrls from
    const std::string OAUTHLIB_TWITTER_REQUEST_TOKEN_URL = "twitter.com/oauth/request_token";
    const std::string OAUTHLIB_TWITTER_AUTHORIZE_URL = "twitter.com/oauth/authorize?oauth_token=";
    const std::string OAUTHLIB_TWITTER_ACCESS_TOKEN_URL = "twitter.com/oauth/access_token";
to
    const std::string OAUTHLIB_TWITTER_REQUEST_TOKEN_URL = "api.twitter.com/oauth/request_token";
    const std::string OAUTHLIB_TWITTER_AUTHORIZE_URL = "api.twitter.com/oauth/authorize?oauth_token=";
    const std::string OAUTHLIB_TWITTER_ACCESS_TOKEN_URL = "api.twitter.com/oauth/access_token";

Original comment by ffo...@gmail.com on 25 Feb 2013 at 3:04

GoogleCodeExporter commented 9 years ago
I am having a similar problem. I am attempting to get the Request token and it 
is returning nothing. 

// Step 2: Get request token key and secret 
twitterObj.oAuthRequestToken( tmpStr );

It just returns OAUTHLIB_TWITTER_AUTHORIZE_URL without appending the necessary 
oauth_token. I tested the TwitterClient.exe in the download section and that 
application no longer works either. 

Original comment by cesar...@gmail.com on 25 Feb 2013 at 9:25

GoogleCodeExporter commented 9 years ago
Have you tried my solution for that issue?  twitterClient app need rebuild to 
work properly as before.

Original comment by ffo...@gmail.com on 25 Feb 2013 at 9:31

GoogleCodeExporter commented 9 years ago
Yeah it didn't work, I think the "http" is required.
const std::string OAUTHLIB_TWITTER_REQUEST_TOKEN_URL = 
"http://api.twitter.com/oauth/request_token";
    const std::string OAUTHLIB_TWITTER_AUTHORIZE_URL = "http://api.twitter.com/oauth/authorize?oauth_token=";
    const std::string OAUTHLIB_TWITTER_ACCESS_TOKEN_URL = "http://api.twitter.com/oauth/access_token";

Original comment by cesar...@gmail.com on 25 Feb 2013 at 9:44

GoogleCodeExporter commented 9 years ago
Even though twitter gives us these as:
Request token URL   https://api.twitter.com/oauth/request_token
Authorize URL   https://api.twitter.com/oauth/authorize
Access token URL    https://api.twitter.com/oauth/access_token

The https:// does not work as:
bool twitCurl::performGet( const std::string& getUrl, const std::string& 
oAuthHttpHeader );

doesn't seem to handle those https request very well. The http will still work. 
I have updated my application and it seems to be working as good as ever. 

Thanks for the point in the right direction.

Original comment by cesar...@gmail.com on 25 Feb 2013 at 9:50

GoogleCodeExporter commented 9 years ago
The solution provided above have solved the problem everything is working as 
before perfectly. Thanks, please commit the above fix in the code.

Original comment by q...@0x80.org on 25 Feb 2013 at 10:20

GoogleCodeExporter commented 9 years ago
"Yeah it didn't work, I think the "http" is required."
the correct protocol added as well (just look at twitCurl::oAuthRequestToken: 
correct url created as "twitCurlDefaults::TWITCURL_PROTOCOLS[m_eProtocolType] + 
oAuthTwitterApiUrls::OAUTHLIB_TWITTER_REQUEST_TOKEN_URL"). so that it's no need 
to add it separately.

Did you make a rebuild of twitcurl.lib before linking twitterClient?

Original comment by ffo...@gmail.com on 26 Feb 2013 at 5:43

GoogleCodeExporter commented 9 years ago
Thanks, correct OAuth URLs are updated in oauthlib.h.

Original comment by swatkat....@gmail.com on 22 Jun 2013 at 7:08