Improper cancellation handling in a web form



I need a Twitter Sign In functionality in my app and thus I use TwitterAuthClient from the official Twitter SDK to implement it.
Everything works fine except of a single scenario:

  1. Twitter app is NOT installed on devices;
  2. User initiates authorization and see the “authorized” web form;
  3. There user click “Cancel” button and thus navigated to the "You have not signed in to " page with "Return to " button;
  4. User presses the "Return to " button.

onActivityResult is fired with RESULT_CANCEL resultCode
onActivityResult is fired with RESULT_FIRST_USER result code, which leads to the Callback#failure method to be fired with TwitterException argument, that can’t be separated from other errors.

The problem as you can see is that by checking the returned TwitterException we can’t determine that authorization has been cancelled by the user. In case of user cancellation no error message should be shown. Current API doesn’t allow to do that.