8

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?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Akshay Aher
  • 2,525
  • 2
  • 18
  • 33
  • 1
    What 'twitter button'? What 'twitter page'? What 'twitter login'? Are you using OAuth in MGTwitterEngine? You really need to provide more information than this. – Alan Zeino May 05 '11 at 07:41
  • 1
    -(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]; } yes i am using OAuth in MGTWitterEngine – Akshay Aher May 05 '11 at 08:08

3 Answers3

3

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.

Adam Storr
  • 1,438
  • 2
  • 21
  • 46
1

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]; }

d4ndym1k3
  • 119
  • 2
  • 16
0

Just put [_engine setClearsCookies:TRUE] when you are reseting the _engine variable and it should work. That is how I got it to work for me!

Farrukh Javeid
  • 634
  • 6
  • 25