3

Before, MGTwitterEngine was working perfectly for me, but now everytime I login, i get an invalid url exception from OAuth. I thought it was because i changed something but when I tried logging in from the iphone simulator, it worked (i was trying from my iphone). I then tried an old copy of my project from 3 days ago when i had absolutely no problem, and now i'm getting the same url error. Has anybody encountered this?

To temporarily fix this, I went into SA_OauthTwitterEngine.m and did

- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate {
    if (self = (id) [super initWithDelegate: delegate]) {
        self.requestTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/request_token"];
        //self.accessTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/access_token"];
        self.accessTokenURL = [NSURL URLWithString: @"https://api.twitter.com/oauth/access_token"];
        self.authorizeURL = [NSURL URLWithString: @"http://twitter.com/oauth/authorize"];
    }
    return self;
}

There was a problem with the http://twitter.com/oauth/access_token url so I changed it to https://api.twitter.com/oauth/access_token which was in the documentation for the twitter API. It just feels uncomfortable having to alter this since it seems to be working fine for everybody else.

Any help is appreciated

Andrew Park
  • 1,489
  • 1
  • 17
  • 26

1 Answers1

0

As you can see on https://dev.twitter.com/docs/api/1/post/oauth/access_token,

Twitter recommends using HTTPS instead of HTTP, so even if it worked many times before you changed to HTTPS, don't feel uncomfortable! Sometimes, a line of code works well, but another one works better. There's nothing uncomfortable in it !

Please use HTTPS for this method, and all other OAuth token negotiation steps.

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

Hope it answers your question.

Karim
  • 5,298
  • 3
  • 29
  • 35