title: Android Twitter integration - stuck in the sign in page?
body: <p>I have code from a previous Android app which I successfully integrated with Twitter. I've copied this code over to a new app and changed the <code>callback-url</code>, <code>consumer-key</code> and <code>consumer-secret</code> for my new app.</p>
  <p>Using the <code>twitter4j</code> library I'm able to get my <code>RequestToken</code> and authentication url as follows:</p>
  <pre><code>Twitter twitter = new TwitterFactory().getInstance();
  twitter.setOAuthConsumer(myConsumerKey, myConsumerSecret);
  RequestToken requestToken = twitter.getOAuthRequestToken(myCallbackUrl);
  String authenticationUrl = requestToken.getAuthenticationURL()
  </code></pre>
  <p>The <code>RequestToken</code> has a non-null <code>token</code> value, a non-null <code>tokenSecret</code> value, and a null <code>secretKeySpec</code> value. The authentication url is of the following form:</p>
  <pre><code>http://api.twitter.com/oauth/authenticate?oauth_token=...
  </code></pre>
  <p>I load this url in my <code>WebView</code> and I see the following page:</p>
  <p><img src="https://i.stack.imgur.com/3xR2J.png" alt="Sign in page" /></p>
  <p>Here I'm stuck. When I click the <code>Sign In</code> button, just this same page keeps loading up. Nothing else. When I click the <code>Cancel</code> button however, I see the following page:</p>
  <p><img src="https://i.stack.imgur.com/Py3mQ.png" alt="enter image description here" /></p>
  <p>Only on this page when I click the <code>Return to Fan League Beko BBL</code> button is my <code>callback-url</code> invoked, with a <code>denied</code> parameter which has my <code>oauth_token</code> as its value. Anyone seen anything like this before and know what might be stopping my sign in request from being processed???</p>
  <blockquote>
  <p><strong>Update 1:</strong> I've tried the authentication url and the <code>Sign In</code> button from a desktop browser and it works as expected, processing the response and then invoking the callback-url. It's just failing when trying it in the <code>WebView</code> of my Android app. I've tried it on multiple Android devices and tablets. JavaScript is enabled on my <code>WebView</code> too so that's not it. Ideas most welcome. I'm out of ideas!</p>
  <p><strong>Update 2:</strong> I've just done some debug-mode code-tracing on my <code>WebView</code>'s <code>WebViewClient</code> and I'm seeing that when I click the <code>Sign In</code> button, the <code>shouldOverrideUrlLoading(WebView webView, String url)</code> method is not called, but the following three methods are called (in order): <code>onPageStarted(WebView view, String url, Bitmap favicon)</code>, <code>onLoadResource(WebView view, String url)</code>, <code>onPageFinished(WebView view, String url)</code>. The <code>url</code> value these methods have is: <code>https://api.twitter.com/oauth/authenticate</code>, i.e. the <code>oauth_token</code> parameter has been stripped off the authenticate url. Maybe this is a <code>POST</code> request being treated as a <code>GET</code> request and hence why this one same page keeps loading up? Any ideas what I can do to have this <code>Sign In</code> button press processed properly?</p>
  </blockquote>