liaolzy / oauth

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

Twitter API + OAuthConsumer.framework #177

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I am working on a test app to help me better understand the way oAuth works 
with the Twitter API for a bigger app I would like to write, however I am 
experiencing an issue posting messages to the API after successfully getting an 
access token.

I am using the OAuthConsumer framework as it seemed to be the easiest way to 
work through the yo-yo that is oAuth...

My code is further down, along with the console log, and I have included a link 
to a ZIP file of the XCode project.

http://dropbox.unknowndomain.co.uk/oAuth-Test-App.zip

Error:

Error Domain=NSURLErrorDomain Code=-1012 UserInfo=0x10029a100 "The operation 
couldn’t be completed. (NSURLErrorDomain error -1012.)" Underlying 
Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1012 UserInfo=0x100296310 
"The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)")

This is the error I get back when it calls the API to send a tweet, now bear in 
mind that I have used this same exact code to call unprotected resources on the 
API with no problem and got a response just fine, however when sending a tweet 
I get an error which on closer investigation I got some hints of an error 401 
which suggests the previous key is not valid, but I cannot imagine why.

I have been sitting on this for a week now completely stumped, so help 
regardless of experience might just uncover a hidden problem, that said a few 
people seem to have had this -1012 error on the Google Code page but there are 
no answers there. `

Console Log:

2010-07-10 23:15:08.909 oAuth Test App[1732:a0f] Request Token: 
oauth_token=***&oauth_token_secret=***&oauth_callback_confirmed=true

2010-07-10 23:15:21.131 oAuth Test App[1732:a0f] Access Token: 
oauth_token=***&oauth_token_secret=***&user_id=***&screen_name=***

2010-07-10 23:15:29.439 oAuth Test App[1732:a0f] EPIC FAIL!

2010-07-10 23:15:29.440 oAuth Test App[1732:a0f] Access Token: <OAToken: 
0x125408160>
2010-07-10 23:15:29.440 oAuth Test App[1732:a0f] Key: ***
2010-07-10 23:15:29.440 oAuth Test App[1732:a0f] Secret: ***

2010-07-10 23:15:29.440 oAuth Test App[1732:a0f] Service Ticket: 
<OAServiceTicket: 0x100296050>

2010-07-10 23:15:29.457 oAuth Test App[1732:a0f] Data: Error 
Domain=NSURLErrorDomain Code=-1012 UserInfo=0x10029a100 "The operation 
couldn’t be completed. (NSURLErrorDomain error -1012.)" Underlying 
Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1012 UserInfo=0x100296310 
"The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.)")

Thanks for your help!

ALSO ON: 
http://stackoverflow.com/questions/3221083/twitter-api-oauthconsumer-framework

Original issue reported on code.google.com by ctst...@googlemail.com on 15 Jul 2010 at 5:39