Unable to Log In with Twitter

fabric
login
twitter4j
twitterkit

#1

Hi! I have installed Fabric and Twitter Log In button for Android. But i am having problems with logging in. I think i missed something, dont i need to initialize Fabric, or enter the Twitter key and secret in the app itself (Manifest maybe?).
Here is my code:

 twitterLoginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
    twitterLoginButton.setCallback(new Callback<TwitterSession>() {
        @Override
        public void success(Result<TwitterSession> result) {
            // The TwitterSession is also available through:
            // Twitter.getInstance().core.getSessionManager().getActiveSession()
            TwitterSession session = result.data;
            // TODO: Remove toast and use the TwitterSession's userID
            // with your app's user model
            String msg = "@" + session.getUserName() + " logged in! (#" + session.getUserId() + ")";
            Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_LONG).show();
            
            finish();
        }

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

And:

   @Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    twitterLoginButton.onActivityResult(requestCode, resultCode, data);
    callbackManager.onActivityResult(requestCode, resultCode, data);

}

Log:

11-13 08:47:07.701 22563-22563/com.sprintzin.nony E/Twitter: Authorization completed with an error
                                                         com.twitter.sdk.android.core.TwitterAuthException: Authorize failed.
                                                             at com.twitter.sdk.android.core.identity.AuthHandler.handleOnActivityResult(AuthHandler.java:98)
                                                             at com.twitter.sdk.android.core.identity.TwitterAuthClient.onActivityResult(TwitterAuthClient.java:161)
                                                             at com.twitter.sdk.android.core.identity.TwitterLoginButton.onActivityResult(TwitterLoginButton.java:131)
                                                             at com.sprintzin.nony.LoginActivity.onActivityResult(LoginActivity.java:87)
                                                             at android.app.Activity.dispatchActivityResult(Activity.java:6439)
                                                             at android.app.ActivityThread.deliverResults(ActivityThread.java:3984)
                                                             at android.app.ActivityThread.handleSendResult(ActivityThread.java:4038)
                                                             at android.app.ActivityThread.access$1400(ActivityThread.java:150)
                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1443)
                                                             at android.os.Handler.dispatchMessage(Handler.java:102)
                                                             at android.os.Looper.loop(Looper.java:168)
                                                             at android.app.ActivityThread.main(ActivityThread.java:5845)
                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                             at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
11-13 08:47:07.701 22563-22563/com.sprintzin.nony D/TwitterKit: Login with Twitter failure
                                                                com.twitter.sdk.android.core.TwitterAuthException: Authorize failed.
                                                                    at com.twitter.sdk.android.core.identity.AuthHandler.handleOnActivityResult(AuthHandler.java:98)
                                                                    at com.twitter.sdk.android.core.identity.TwitterAuthClient.onActivityResult(TwitterAuthClient.java:161)
                                                                    at com.twitter.sdk.android.core.identity.TwitterLoginButton.onActivityResult(TwitterLoginButton.java:131)
                                                                    at com.sprintzin.nony.LoginActivity.onActivityResult(LoginActivity.java:87)
                                                                    at android.app.Activity.dispatchActivityResult(Activity.java:6439)
                                                                    at android.app.ActivityThread.deliverResults(ActivityThread.java:3984)
                                                                    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4038)
                                                                    at android.app.ActivityThread.access$1400(ActivityThread.java:150)
                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1443)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                    at android.os.Looper.loop(Looper.java:168)
                                                                    at android.app.ActivityThread.main(ActivityThread.java:5845)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

#2

Yeah, sorry, found the problem, the initialization was in another activity. Silly me…


#3