title: URL Redirect Following JSONP API
body: <h2><strong>Long version:</strong></h2>
  
  <p>So, im working on my schools website and I need to get past same-origin enforcement. I'm not trying to scam anyone or anything; my school uses Google Apps and a seperate gradebook system, both of which use the same username and password because the school has the Google Apps login replaced with their own single sign on deal. The problem is the single sign in form requires an AuthID that is generated on Google's side. So when you go to the google apps login page for the school, it redirects to the page with the single sign on form and the AuthID in the url as a GET parameter. If I can get at this AuthID using Javascript then I would be fine and the user would be able to sign in from my page.</p>
  
  <h2><strong>Short Version:</strong></h2>
  
  <p><strong>The Problem:</strong> I need to send a request to a URL which then redirects to another URL that has something in its GET parameters in the URL (an id) that I need.</p>
  
  <p><strong>What I've tried:</strong></p>
  
  <ul>
  <li>AJAX - the url is on another domain and cross-domain is not allowed</li>
  <li>iframe - not allowed to get the location of an iframe with a different domain</li>
  </ul>
  
  <p>Basically does anyone know of a JSONP API that follows URLs and returns the URL of the redirect? Or another solution to this entirely?</p>
  
  <p>Pleas let me know if I can clarify anything.</p>
  
  <p>Thanks in advance!</p>
  
  <hr>
  
  <p><strong>Edit</strong>: <a href="http://web-sniffer.net/" rel="nofollow">This site</a> for example is exactly what I need except in JSONP API form. When I put my URL in there it shows a 302 redirect header with a "Location" whose value is the exact URL that I need.</p>
  
  <p>So i give it a url like this:</p>
  
  <pre><code>https://sso.thewebsite.org/simplesaml/saml2/idp/SSOService.php?app_name=Google&amp;SAMLRequest=...
  </code></pre>
  
  <p>and it shows that the response was a 302 redirect with</p>
  
  <pre><code>Location: https://sso.thewebsite.org/simplesaml/module.php/core/loginuserpass.php?AuthState=[this_is_what_i_need]...
  </code></pre>