Fabric Twitter Login module does not work correctly with Android 4.x devices




I am currently supporting Twitter login in my Android application.
While the twitter Login runs successfully on Android 5.x devices, I am running into an issue on Android 4.x devices only.

On android 4.x devices, after entering the twitter credentials(username and passwd) on the authentication screen, it does not return back to my application.
In fact when I press the “Authorize app” button on the authentication screen, nothing happens! However when the Twitter client application (available on Google play store) is installed on the device, the authentication works fine and returns back to my app once the authentication is done.

Having debugged a bit, I feel this could be an issue with the WebView Client used in the “com.twitter.sdk.android.core.identity.OAuthActivity” within the Twitter core module.
(the shouldOverrideUrl() method checking for the callBack URL is never called for Android 4.x devices. The same is called for android 5.x devices).

Stuck at this issue for couple of days now. Any help would be greatly appreciated.
Kindly let me know in case any additional details are required for debugging.



Thanks for reaching out on this @vishy_nk, could you enable debug mode and then send over the Logcat when this happens?


@bonnell Thanks for the reply.

Here’s a link to the logcat for this issue

Below is a short description of the flow of events as per the logs.

  1. When the authentication starts, the OAuth (not SSO) method is chosen since the Twitter official android client is not installed on the device
D/Twitter ( 6321): Using OAuth
  1. Displays the Oauth activity screen
I/ActivityManager(  896): Displayed jp.mixi/com.twitter.sdk.android.core.identity.OAuthActivity: +221ms
  1. Redirecting to Webview for the authentication step
    D/Twitter ( 6321): Redirecting user to web view to complete authorization flow

  2. After entering my credentials and waiting for sometime, the control does not return to the app.
    I wait for sometime and then press the back key on which the OAuth request cancel is detected by the Twitter SDK and authorisation failed exception is logged

D/Twitter ( 6321): onActivityResult called with 140 0
E/Twitter ( 6321): Authorization completed with an error
E/Twitter ( 6321): com.twitter.sdk.android.core.TwitterAuthException: Authorization failed, request was canceled.
E/Twitter ( 6321): 	at com.twitter.sdk.android.core.identity.OAuthActivity.onBackPressed(OAuthActivity.java:85)