Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when using Twitter to log in to my iPhone app

I am using Twitter login to enter in my app. But when I click on the Twitter button, the Twitter page opens, but I get the following error:

WHOA there!!! This page is no longer valid.it looks like someone already used the token information you provide.please return to the site tht sent you to this page or try again. it was an probably an honest mistake.

-(void)twitterclick 
{ 
SA_OAuthTwitterEngine *_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; engine.consumerKey=[[NSString alloc]init];
 _engine.consumerSecret=[[NSString alloc]init];
 _engine.consumerKey = @"App consumer key";
 _engine.consumerSecret = @"App Consumer secret"; 
UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self]; 
if (controller) 
[self presentModalViewController:controller animated:YES];
 } 

How might I resolve this?

like image 733
Akshay Aher Avatar asked May 05 '11 05:05

Akshay Aher


2 Answers

I had the same problem... it turned out to be related to the system time on my device.

Not sure how it happened.. but after changing the date, it worked.

like image 64
Adam Storr Avatar answered Nov 06 '22 22:11

Adam Storr


your trying to use OAuthData that's too old for use(expired) in MGTwitterEngine.m look for `#endif

    _secureConnection = YES;
    _clearsCookies = NO;`

and change _clearsCookies=YES;

then at the start of your 'twitterClick' put [self clearsCookies]; then the rest of your code

-(void)twitterclick { [self clearsCookies]; SA_OAuthTwitterEngine *_engine = [[SA_OAuthTwitterEngine alloc] initOAuthWithDelegate:self]; engine.consumerKey=[[NSString alloc]init]; _engine.consumerSecret=[[NSString alloc]init]; _engine.consumerKey = @"App consumer key"; _engine.consumerSecret = @"App Consumer secret"; UIViewController *controller = [SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine: _engine delegate: self]; if (controller) [self presentModalViewController:controller animated:YES]; }

like image 38
d4ndym1k3 Avatar answered Nov 06 '22 23:11

d4ndym1k3