twitter-kit-android icon indicating copy to clipboard operation
twitter-kit-android copied to clipboard

Inconsistent TwitterAuthClient#authorize() unhappy scenarios handling

Open koral-- opened this issue 8 years ago • 4 comments

  • Steps to reproduce the problem: Call TwitterAuthClient#authorize() and don't complete the flow successfully eg. disable internet connection before or cancel.
  1. when there is no internet connection at the beginning:

a) nothing is displayed b) Callback.failure() is called with TwitterAuthException: Failed to get request token c) resultCode in onActivityResult() is RESULT_FIRST_USER

  1. when back button was clicked:

a) Callback.failure() is called with TwitterAuthException: Authorization failed, request was canceled. b) resultCode in onActivityResult() is RESULT_CANCELLED

  1. when cancel button was clicked:

a) Callback.failure() is called with TwitterAuthException: Failed to get authorization, bundle incomplete b) resultCode in onActivityResult() is RESULT_FIRST_USER

  1. when internet connection is lost after WebView is displayed:

a) activity with WebView is finished immediately without any error message b) Callback.failure() is called with TwitterAuthException: OAuth web view completed with an error c) resultCode in onActivityResult() is RESULT_FIRST_USER

  • Expected behavior: If it is intended to not show any error to user from Twitter kit in some cases (like 1. and 4.) then callback parameters should allow developers to easily distinguish errors from cancellations so they can show their own UI. As you can see nor resultCode nor TwitterException can be used for that. If it is not intended then Twitter kit should always display something after calling TwitterAuthClient#authorize().
  • Android API Version: 21+
  • Android Device: all
  • Artifact Versions:
+--- com.twitter.sdk.android:twitter:1.13.1
|    +--- com.digits.sdk.android:digits:1.10.3
|    |    +--- io.fabric.sdk.android:fabric:1.3.10
|    |    \--- com.twitter.sdk.android:twitter-core:1.6.6
|    |         +--- com.squareup.retrofit:retrofit:1.8.0
|    |         |    \--- com.google.code.gson:gson:2.3
|    |         +--- io.fabric.sdk.android:fabric:1.3.10
|    |         \--- com.google.code.gson:gson:2.2.4 -> 2.3
|    +--- io.fabric.sdk.android:fabric:1.3.10
|    +--- com.twitter.sdk.android:tweet-composer:1.0.3
|    |    +--- io.fabric.sdk.android:fabric:1.3.10
|    |    +--- com.twitter:twitter-text:1.13.0
|    |    \--- com.squareup.picasso:picasso:2.5.2
|    +--- com.twitter.sdk.android:tweet-ui:1.10.1
|    |    +--- io.fabric.sdk.android:fabric:1.3.10
|    |    +--- com.android.support:support-v4:22.2.0 -> 23.3.0 (*)
|    |    +--- com.twitter.sdk.android:twitter-core:1.6.6 (*)
|    |    \--- com.squareup.picasso:picasso:2.5.2
|    \--- com.twitter.sdk.android:twitter-core:1.6.6 (*)

koral-- avatar May 04 '16 15:05 koral--

Having the same issue...

@koral-- Did you manage to find a workaround for these issues (specifically handling the cancelling of Twitter log in)?

LaurieScheepers avatar May 11 '17 12:05 LaurieScheepers

In Callback#failure() method I do nothing. If resultCode is not in [RESULT_OK, RESULT_CANCELED] I display a general Twitter error message to the user. In the case of other results, I do nothing.

koral-- avatar May 11 '17 16:05 koral--

Any news about this?

I`m getting

com.twitter.sdk.android.core.TwitterAuthException: Failed to get authorization, bundle incomplete

But Im not able to reproduce because Im sending this error report to Fabric

cotfas avatar Oct 30 '17 14:10 cotfas

Any update on this issue?

I am also getting the same.

randheer094 avatar Nov 09 '17 15:11 randheer094