views:

108

answers:

2

This case is really strange, i've spent 2 whole days to get Twitter Oauth working with the iPhone and i failed over and over again. Its strange since most of the people don't seem to have the same problem as me.

First of all, the Consumer Key and Consumer Secret is okay, i tried with 2 OAuth apps (Twitter) with every possible configuration and got nothing, i even tried with a completely funcional app and the result was the same. So the Twitter app is okay, the problem doesnt lie there.

I've tried Bengottlieb's solution: http://github.com/bengottlieb/Twitter-OAuth-iPhone provided my Consumer Key and Secret and all i've got from Twitter is a "Sorry, the page doesn't exist".

I tried with "ShareKit" which is intended to be a n00b's proof drop in component, you just need to provide your Consumer key and Consumer Secret and i receive the message: "Request Error: There was a problem requesting authorization from Twitter".

I've tried including only OAuthConsumer and implementing code as tutorials say and i receive again the "Sorry, the page doesn't exist" page.

I'm using XCode 3.2.3 with the SDK 4.0 and i will download the 3.2.4 as another desperate solution.

Any help will be appreciated and maybe you achieve to make kids stop crying :'(

Thanks in advance :)

A: 

I know you said your consumer key / secret pair are correct, but unless you started messing around in ShareKit's code, that's basically the only thing that could be wrong. Are you absolutely, 100% sure you're using the consumer key and secret provided to you by Twitter when you registered the application?

Gordon Fontenot
I'm sure they were right but since you took your time to help i am trying once more and. 1.- I am resetting the Consumer key / secret and copied them to TextEdit(notepad). 2. Then i download the ShareKit 0.2.1 and open the example project. 3. i provide the obtained Consumer key/secret pair, modifying the parameters SHKTwitterConsumerKey,SHKTwitterSecret and SHKTwitterCallbackUrl matches the "callback URL" specified in the apps contiguration. 4. Testing and.... failed 5.- Checking provided parameters and they are okay, the app is configured to accept Login from Twitter. Any other suggestion? :(
Leopoldo
Change `SHKDebugShowLogs` (in `SHKConfig.h`) to 1, and see what the request response body is (should print in the console). That should give a bit more information as to what the problem is.
Gordon Fontenot
Thanks for the advice Gordon!
Leopoldo
+3  A: 

Thanks Gordon, your advice took me to the solution. I was receiving from Twitter the message "Failed to validate oauth signature and token". I googled it and found that i needed to change the Time zone.

If someone has the same problem on your Mac do this:

-Click on the clock and then "Date & Time preferences" -Check "Set date and time automatically with: Apple Americas/U.S. (time.apple.com)"

That's all, the problem was with the timestamp which had been generated with an incorrect hour.

2 days wasted for such stupid thingy XD

Leopoldo
That's ridiculous. Glad you got it sorted out.
Gordon Fontenot