Twitter Login not working in Nougat Devices using twitter core


Twitter login using twitter core is not working on Android Nougat devices. While the same code works for Android Marshmallow devices. Nougat device, doesn’t have twitter app, and it doesn’t even open webview for the same, while in non-nougat devices, it falls back to webview if app is not installed in the phone.

It always gives authorization error in nougat devices with status code 403 and 401.

This is my activity code for login

    protected void onCreate(Bundle savedInstanceState) {
        loginButton = (TwitterLoginButton) findViewById(;
        loginButton.setCallback(new Callback<TwitterSession>() {
            public void success(Result<TwitterSession> result) {

                // Do something with result, which provides a TwitterSession for making API calls

            public void failure(TwitterException exception) {
                Log.d("failure: ",exception.getMessage());
                // Do something on failure

I have initialized twitter config in the application class.

public class MyApplication extends Application {
    public void onCreate() {
        TwitterConfig config = new TwitterConfig.Builder(this)
                .logger(new DefaultLogger(Log.DEBUG))
                .twitterAuthConfig(new TwitterAuthConfig("xxxxxxxxxx", "xxxxxxxxxxxx"))