Shadowtech
Shadowtech

Reputation: 376

OAuth access Token fails while accessing twitter from iOS 5

I am using MGTwitterEngine" to Integrate twitter in my app.It works fine up to iOS 4.2 . When I try to access twitter from any of the iOS 5 device , I am experiencing an authentication token issue.

This page is no longer valid. It looks like someone already used the token information you provided. Please return to the site that sent you to this page and try again ... it was probably an honest mistake

After a lot of googling I found some suggestions .But they didn't solve my issue. Tried https instead http .

Upvotes: 2

Views: 3035

Answers (3)

user1079903
user1079903

Reputation:

I tried all of the above solutions, but these were not able to fix this issue. Finally I did this:

requestRequestToken set new request token

 [engine requestRequestToken];// added this to remove the old request token because old request token will not work with new authentication request 
 UIViewController *controller = [[SA_OAuthTwitterController controllerToEnterCredentialsWithTwitterEngine:engine delegate:self] retain];  
 [delegate presentModalViewController: controller animated: YES];

Note: It increases the time of loading a web view.

I think it will help.

Upvotes: 2

Mahendran
Mahendran

Reputation: 2719

Try replacing

Request token URL

https://api.twitter.com/oauth/request_token

Authorize URL

https://api.twitter.com/oauth/authorize

Access token URL

https://api.twitter.com/oauth/access_token

I this this should work.

Upvotes: 9

Rotten
Rotten

Reputation: 742

I solve this problem detecting iOS version in order to use MGTwitterEngine for iOS 4.3 and earlier version and TWRequest and Twitter API for iOS5.

NSString *requiredVersion = @"5.";

NSRange aRange = [[[UIDevice currentDevice] systemVersion] rangeOfString:requiredVersion];


if (aRange.location == NSNotFound )
{
      //MGTwitterEngine here
} else {
      //Twitter API here
}

This works for me, I hope it will do it for you.

Upvotes: 2

Related Questions