title: twitter is not redirecting to the callback url in android app
body: <p>My aim is to allow Twitter logins using twitter4j.   <a href="https://github.com/Sheikh-Aman/Android_Samples/blob/master/1.%20Sign-inWithTwitterT4J/src/com/aman/samples/t4jsignin/Main.java" rel="nofollow">I used this as reference.</a></p>
  
  <p>The problem is that at line 64, it calls <code>getAuthenticationURl()</code>. When I execute it takes me to the login page, instead of the page where I can allow/disallow my app access to the ppl's account.<br>
  However, if I change it to <code>getAuthorizationUrl()</code> it takes to the correct page. </p>
  
  <p>1) So what is the difference between the two? </p>
  
  <p>2) This is the important question. I am providing the code below. </p>
  
  <pre><code>package com.example.twitter;
  
  
  
  import twitter4j.Twitter;
  import twitter4j.TwitterException;
  import twitter4j.TwitterFactory;
  import twitter4j.http.AccessToken;
  import twitter4j.http.RequestToken;
  import android.app.Activity;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class WriteTweet extends Activity{
      public final static String consumerKey = "xxxxxxxxxxxxxxxxxx";
      public final static String consumerSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
      private final String CALLBACKURL = "T4J_OAuth://callback";
      Twitter twitter;
      RequestToken requestToken;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          loginUser();
      }
  
      private void loginUser() {
          // TODO Auto-generated method stub
          try {
              twitter = new TwitterFactory().getInstance();
              twitter.setOAuthConsumer(consumerKey, consumerSecret);
              requestToken = twitter.getOAuthRequestToken(CALLBACKURL);
              String authUrl = requestToken.getAuthorizationURL();
              this.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                      .parse(authUrl)));
          } catch (TwitterException ex) {
              Toast.makeText(this, ex.getMessage(), Toast.LENGTH_LONG).show();
              Log.e("in Main.OAuthLogin", ex.getMessage());
          }
      }
      @Override
      protected void onNewIntent(Intent intent) {
          Log.e("hi","hi");
          super.onNewIntent(intent);
          Uri uri = intent.getData();
          try {
              String verifier = uri.getQueryParameter("oauth_verifier");
              AccessToken accessToken = twitter.getOAuthAccessToken(requestToken,
                      verifier);
              String token = accessToken.getToken(), secret = accessToken
                      .getTokenSecret();
              displayTimeLine(token, secret); //after everything, display the first tweet 
  
          } catch (TwitterException ex) {
              Log.e("Main.onNewIntent", "" + ex.getMessage());
          }
  
      }
      @SuppressWarnings("deprecation")
      void displayTimeLine(String token, String secret) {
          Log.e("display","timeline");
      }
  
  }
  </code></pre>
  
  <p>the manifest is</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.twitter"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="15" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;application
  
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
  
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
  
          &lt;activity android:name=".ListTweets" &gt;
  
          &lt;/activity&gt;
          &lt;activity android:name=".WriteTweet"&gt; 
                  &lt;intent-filter&gt;  
                      &lt;action android:name="android.intent.action.VIEW" /&gt;
                      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;  
                      &lt;data android:scheme="T4J_OAuth" android:host="callback" /&gt;
                  &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".ViewFollowers"&gt;
  
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The problem is that it redirects me to <a href="https://mobile.twitter.com/" rel="nofollow">https://mobile.twitter.com/</a> 
  and I cant figure out what am doing wrong. The problem exist no matter if whether <code>getAuthenticationUrl()</code> or <code>getAuthorizationUrl()</code> is used. I had provided a dummy url in the <code>callback_url</code> field in Twitter. 
  If I didn't provide a <code>callbackurl</code> in code and in the twitter page it will give me a pin number. But that is not what I want. I need my twitter to redirect to my app. How can I achieve this?</p>