Search code examples
androidtwitter-oauthtwitter-fabric

Why is Twitter session response null?


I have a custom button for twitter login. When I authorise in twitter using this button, I get back twitterSessionResult. But the response property of this object is null. How can I get twitter id and email?

    twitterButton = (FancyButton) findViewById(R.id.twitter_login_button);
    twitterButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {


            twitterAuthClient.authorize(WelcomeActivity.this, new com.twitter.sdk.android.core.Callback<TwitterSession>() {

                @Override
                public void success(Result<TwitterSession> twitterSessionResult) {
                    Log.w("LOG", ""+ twitterSessionResult.response); // LOG: null 
                }

                @Override
                public void failure(TwitterException e) {
                    e.printStackTrace();
                }
            });


        }
    });

Solution

  • Found answer here: https://stackoverflow.com/a/29982457/3400881 . I need twitterSessionResult.data, not twitterSessionResult.response .