Login with Twitter failure
<p>When i login with twitter in my android app ,i meet some question .The error log as follows:</p>

<pre><code>09-05 15:38:48.492 22119-22119/sg.com.conversant.swiftlive E/Twitter: Failed to get request token com.twitter.sdk.android.core.TwitterApiException: HTTP request failed, Status: 401
   at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
   at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5118)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
   at dalvik.system.NativeStart.main(Native Method)
09-05 15:38:48.552 22119-22119/sg.com.conversant.swiftlive E/Twitter: Authorization completed with an error com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
   at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
   at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:194)
   at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
   at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5118)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
   at dalvik.system.NativeStart.main(Native Method)
09-05 15:38:48.552 22119-22119/sg.com.conversant.swiftlive D/TwitterKit: Login with Twitter failure com.twitter.sdk.android.core.TwitterAuthException: Failed to get request token
   at com.twitter.sdk.android.core.identity.OAuthController$1.failure(OAuthController.java:95)
   at com.twitter.sdk.android.core.internal.oauth.OAuth1aService$1.failure(OAuth1aService.java:194)
   at com.twitter.sdk.android.core.Callback.onResponse(Callback.java:42)
   at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5118)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
   at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>By the way , I have already set callback Url in my twitter setting page .</p>

<p>Can you help me solve this problem ?Thank you very much .</p>

<p>i used custom button to implements my function.Some code as follows:</p>

<pre><code>private static final String TWITTER_KEY = "*******************";
private static final String TWITTER_SECRET = "*************";

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig));

    ButterKnife.inject(this);

    setCallback(new com.twitter.sdk.android.core.Callback&lt;TwitterSession&gt;() {
        @Override
        public void success(Result&lt;TwitterSession&gt; result) {
            AccountService ac = Twitter.getApiClient(result.data).getAccountService();
            Call&lt;User&gt; call   = ac.verifyCredentials(true,true);
            call.enqueue(new Callback&lt;User&gt;() {
                @Override
                public void onResponse(Call&lt;User&gt; call, Response&lt;User&gt; response) {
                    User user = response.body();
                    user_id = Long.toString(user.id);
                    nickName =  user.name;
                    avatar = user.profileImageUrl ;
                    if (user_id != null) {
                        System.out.println(user_id+":"+nickName+":"+avatar);
                    }
                }

                @Override
                public void onFailure(Call&lt;User&gt; call, Throwable t) {

                }
            });
        }

        @Override
        public void failure(TwitterException exception) {
            Log.d("TwitterKit", "Login with Twitter failure", exception);
        }
    });
}




View.OnClickListener clickListener = new View.OnClickListener() {
    @Override
    public void onClick(View v) {

            case R.id.login_twitter_btn:
                getTwitterAuthClient().authorize(activity, callback);
                break;
        }

    }
};


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == getTwitterAuthClient().getRequestCode()) {
        getTwitterAuthClient().onActivityResult(requestCode,resultCode, data);
    }

}

public void setCallback(com.twitter.sdk.android.core.Callback&lt;TwitterSession&gt; callback) {
    if (callback == null) {
        throw new IllegalArgumentException("Callback cannot be null");
    }
    this.callback = callback;
}
TwitterAuthClient getTwitterAuthClient() {
    if (authClient == null) {
        synchronized (LoginActivity.class) {
            if (authClient == null) {
                authClient = new TwitterAuthClient();
            }
        }
    }
    return authClient;
}
</code></pre>