title: Twitter Oauth Callback Override Failing
body: <p>So I have setup a twitter application so that people can reply to tweets inside my own app. I have a callback URL and when I do not try and override it everything seems to go fine. However Now I am having a problem getting the override of the callback to work the app runs on multiple sub domains and servers based on what stage of development it is in and I would like to override the callback to the current url.</p>
  
  <p>When I do override the callback and twitter attempts to send the User back to that page I get to a page that says "Sorry, that page doesn’t exist!"</p>
  
  <p>and the URL looks something like this</p>
  
  <p><a href="https://twitter.com/oauth/http%3A//127.0.0.1/authtwitter%3FtwitterCallback?oauth_token=VALUE&amp;oauth_verifier=VALUE" rel="nofollow">https://twitter.com/oauth/http%3A//127.0.0.1/authtwitter%3FtwitterCallback?oauth_token=VALUE&amp;oauth_verifier=VALUE</a></p>
  
  <p>and Here is my Python code using this library for the oauth: <a href="https://github.com/simplegeo/python-oauth2" rel="nofollow">https://github.com/simplegeo/python-oauth2</a></p>
  
  <pre><code>    #SETUP TWITTER AUTHORIZATION OBJECT
      request_token_url = 'http://twitter.com/oauth/request_token'
      access_token_url = 'http://twitter.com/oauth/access_token'
      authorize_url = 'http://twitter.com/oauth/authenticate'
  
      consumer = oauth.Consumer(consumer_key, consumer_secret)
      client = oauth.Client(consumer)
  
      #get request token
      callbackURL = urllib.quote("%s?twitterCallback" % self.request.url)
  
      resp, content = client.request(request_token_url, "POST", body=urllib.urlencode({'oauth_callback':callbackURL}))
      if resp['status'] != '200':
              raise Exception("Invalid Response %s." %resp['status'])
  
      request_token = dict(urlparse.parse_qsl(content))
  
      tmpldict['callbackURL'] = callbackURL
      tmpldict['oauth_token'] = request_token['oauth_token']  
      tmpldict['twitauthurl'] = "%s?oauth_token=%s" % ( authorize_url, request_token['oauth_token'] )                               
  
      qargs=urlparse_qs(self.request.url,True,False)
  
      if 'oauth_verifier' in qargs:
              oauth_verifier = qargs['oauth_verifier'][0]
      else:
              oauth_verifier = None
  
      if oauth_verifier:
              token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret'])
              token.set_verifier(oauth_verifier)
  
              client = oauth.Client(consumer,token)
  
              resp, content = client.request(access_token_url, "GET")
              access_token = dict(urlparse.parse_qsl(content))
  </code></pre>
  
  <p>Current Flow for User</p>
  
  <p>Click authorization URL</p>
  
  <p>Hit Allow Access on Twitter</p>
  
  <p>Twitter Displays: Redirecting you back to the application</p>
  
  <p>Cannot Find page with URL like the example above.</p>