Error when using Twitter to log in to my iPhone app
Asked Answered
B

3

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?

Beachcomber answered 5/5, 2011 at 5:7 Comment(2)
What 'twitter button'? What 'twitter page'? What 'twitter login'? Are you using OAuth in MGTwitterEngine? You really need to provide more information than this.Maybellemayberry
-(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 MGTWitterEngineBeachcomber
F
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.

Fossa answered 8/9, 2011 at 19:54 Comment(0)
A
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]; }

Afoot answered 6/5, 2011 at 12:53 Comment(0)
S
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!

Stereopticon answered 28/6, 2012 at 10:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.