title: Response URL different from initial browser URL
body: <p><strong>Im getting a different URL from what was initially displayed when tried on a browser</strong></p>
  
  <p>Facebook's docs say that a 
  <a href="https://i.stack.imgur.com/1U2Rw.png" rel="nofollow noreferrer">Login Request</a>
  should have a format like this so using requests and urllib.parse I tried getting the response URL</p>
  
  <pre><code>import requests, facebook, logging
  
  # REQUIRED AUTHENTICATION PARAMS
  APP_ID = '1976346389294466'
  APP_SECRET = '*************************'
  REDIRECT_URI = 'https://www.facebook.com/connect/login_success.html/'
  
  logging.basicConfig(level=logging.DEBUG)
  perms = ['manage_pages','publish_pages']
  fb_login_url = facebook.auth_url(app_id=APP_ID, canvas_url=REDIRECT_URI, perms=perms)
  logging.debug("-----LOGIN URL:" + fb_login_url)
  
  response = requests.get(fb_login_url, params={'response_type':'token'}, allow_redirects=True)
  try:
      response.raise_for_status()
  except Exception as exec:
      print("%(There was a problem)s" % (exec))
  
  response = requests.get(response.url)
  logging.debug("-----Response URL: "+response.url)
  </code></pre>
  
  <p>I'm expecting a <a href="https://i.stack.imgur.com/12XpI.png" rel="nofollow noreferrer">Expected Return URL</a> in the format of </p>
  
  <pre><code>https://www.facebook.com/connect/login_success.html#
      access_token=ACCESS_TOKEN...
  </code></pre>
  
  <p>However, I'm only getting the correct response when I use a browser, on my program the response returns a URL of an entirely different format</p>
  
  <pre><code>https://www.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxxxxxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fwww.facebook.com%2Fv2.11%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fwww.facebook.com%252Fconnect%252Flogin_success.html%252F%26scope%3Dmanage_pages%252Cpublish_pages%26response_type%3Dtoken%26client_id%xxxxxxxxxxx%26ret%3Dlogin%26logger_id%xxxxxxxxxxxxxxx&amp;cancel_url=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%2F%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%23_%3D_&amp;display=page&amp;locale=en_US&amp;logger_id=xxx-xxxxx-xxxxx-xxxxxxxx
  </code></pre>
  
  <p>When I GET from the last redirect url from response.history,
  the response returns a url to itself, so I'm not sure how to go about capturing
  the initial value of the url such as when I use the browser</p>
  
  <p>the thing is, Im not looking for anything else from the response besides the URL itself.</p>
  
  <p><em>Additional Notes:</em></p>
  
  <p><em>-in the browser after getting the response url I think javascript also changes the url to blank after a brief moment for security reasons</em></p>
  
  <p><em>-When I enter the wrong formatted url to the browser, it redirects to the right value so is there something thats handling the response differently when I'm using the browser. If so, how do grab the right url?</em></p>
  
  <p><strong>Simply put</strong></p>
  
  <p>When I enter fb_login_url in browser I get...</p>
  
  <pre><code>https://www.facebook.com/connect/login_success.html#access_token=ACCESS_TOKEN...
  </code></pre>
  
  <p>which is what I want, but
  when I do it in the app with requests...
  either with <code>requests.get(fb_login_url).url</code>
  OR (because of a 303) something like</p>
  
  <pre><code>for r in response.history:
  requests.get(r.url).url
  </code></pre>
  
  <p>i get the wrong url which is</p>
  
  <pre><code>https://www.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxxxxxxx&amp;signed_next=1&amp;n....
  </code></pre>