title: No redirect to callback URL when authenticating to Instagram
body: <p>I am having troubles with my server-side login flow to Instagram. I am using:</p>
  
  <ul>
  <li><code>passport.js</code> (passport-instagram) in my Node.js server, at the domain <code>example.com</code></li>
  <li>A simple <code>WebView</code> in my android client.</li>
  </ul>
  
  <p>The issue is that <strong>sometimes</strong> after typing the credentials the client is <strong>not redirected</strong> to the callback url. </p>
  
  <h3>These are the URLs as seen from the client when everything is working:</h3>
  
  <ul>
  <li><p><a href="https://example.com/auth/instagram" rel="noreferrer">https://example.com/auth/instagram</a> : user visits my server and is redirected to instagram</p></li>
  <li><p><a href="https://api.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https%3A%2F%2Fexample.com%2Fauth%2Fredirect%2Finstagram&amp;client_id=XXXXX" rel="noreferrer">https://api.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https%3A%2F%2Fexample.com%2Fauth%2Fredirect%2Finstagram&amp;client_id=XXXXX</a></p></li>
  <li><p><a href="https://example.com/auth/redirect/instagram?code=YYYYY" rel="noreferrer">https://example.com/auth/redirect/instagram?code=YYYYY</a> : we reach the callback url</p></li>
  </ul>
  
  <h3>These are the URLs as seen from the client when the flow is <strong>not</strong> working:</h3>
  
  <ul>
  <li><p><a href="https://example.com/auth/instagram" rel="noreferrer">https://example.com/auth/instagram</a> : user  visits my server and is redirected to instagram</p></li>
  <li><p><a href="https://api.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https%3A%2F%2Fexample.com%2Fauth%2Fredirect%2Finstagram&amp;client_id=XXXXX" rel="noreferrer">https://api.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https%3A%2F%2Fexample.com%2Fauth%2Fredirect%2Finstagram&amp;client_id=XXXXX</a> : same as before</p></li>
  <li><p><a href="https://www.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https://example.com/auth/redirect/instagram&amp;client_id=XXXXX" rel="noreferrer">https://www.instagram.com/oauth/authorize/?response_type=code&amp;redirect_uri=https://example.com/auth/redirect/instagram&amp;client_id=XXXXX</a></p></li>
  <li><p><a href="https://www.instagram.com/accounts/login/?force_classic_login=&amp;next=/oauth/authorize/%3Fresponse_type%3Dcode%26redirect_uri%3Dhttps%3A//example.com/auth/redirect/instagram%26client_id%3DXXXXX" rel="noreferrer">https://www.instagram.com/accounts/login/?force_classic_login=&amp;next=/oauth/authorize/%3Fresponse_type%3Dcode%26redirect_uri%3Dhttps%3A//example.com/auth/redirect/instagram%26client_id%3DXXXXX</a> : here I type my credentials</p></li>
  <li><p><a href="https://www.instagram.com/" rel="noreferrer">https://www.instagram.com/</a></p></li>
  </ul>
  
  <p>As you can see, at the end of the login, instead of being redirected to my server, I end up in <a href="https://www.instagram.com/" rel="noreferrer">https://www.instagram.com/</a> (successfully logged in, by the way).</p>
  
  <p>Why is this happening?</p>
  
  <p>I have no idea myself. Everything seems properly encoded. Might be some Android <code>WebView</code> setting that has to be tweaked (but the same WebView works great with authenticating with other auth providers), might be some <code>passport.js</code> configuration error (but I am using it successfully for all other providers), ...</p>