TwitterCore.getInstance().logIn() not working



I want to implement a Twitter login without using TwitterLoginButton. I was trying to implement TwitterCore.getInstance().logIn(activity, callback) method and when I ran my app it shows the UI to login but wasn’t able to handle the response in Callback<TwitterSession> methods (onSuccess/onFailure).

Can you please give me any direction of how to achieve a proper response handling with this method?


I have the problem too, Do you solve it,And can you tell me how to solve it. thank you. :smile:

I almost try this for a week,and I guess that it is an error of sdk. :tired_face:


Hi xiaoxin011!

Actually I did solve it, but I didn’t use TwitterCore.getInstance().logIn(activity, callback);.

Instead I used:

twitterAuthClient.authorize(activity, callback);```

And what I had to do was to override `onActivityResult(int requestCode, int resultCode, Intent data)` method in the activity that I'm passing in the `authorize` method and in this override method you just need to call `twitterAuthClient.onActivityResult(requestCode, resultCode, data);` and your `onSuccess/onFailure` callbacks will be called.

Hope it helps!

closed #4