aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 549 forks source link

cognitoauth: Erroneous "user cancelled" AuthNavigationException Thrown by AuthClient #328

Closed kyarosh closed 5 years ago

kyarosh commented 7 years ago

To help us solve your problem better, please answer the following list of questions.

mreddyg commented 7 years ago

Thank you for reporting this bug, we are investigating it.

erodewald commented 7 years ago

Has anybody found a possible workaround?

mdemouchy commented 7 years ago

Hello, I still have this issue with the last version of the AWS SDK. Someone found the way to solve this ?

drxeno02 commented 7 years ago

Hello, every time the user gets redirected back to the app they will receive the error, "user canceled". The culprit is this snippet of code in the AuthClient.

/**
 * Callback for Custom Tabs to track navigation.
 */
private final CustomTabsCallback customTabsCallback = new CustomTabsCallback() {
    @Override
    public void onNavigationEvent(final int navigationEvent, final Bundle extras) {
        super.onNavigationEvent(navigationEvent, extras);
        if (navigationEvent == ClientConstants.CHROME_NAVIGATION_CANCELLED) {
            userHandler.onFailure(new AuthNavigationException("user cancelled"));
        }
    }
};

Ignore this and consider it log verbosity 'information'. This will not prevent other errors from being thrown or the success of authentication, it really only signifies that the user was redirected back into the app via the redirect link (your uri). Although I will be the first to admit that it is extremely annoying as the onFailure callback can potentially be processed multiple times in one instance, once for the user cancelled and another for actual errors e.g. InvalidParamterException or AuthServiceException

Plinzen commented 6 years ago

Hi, is there any plan to fix this issue? It's quite difficult to distinguish between a real error or just a "log information".

minbi commented 5 years ago

Hi @kyarosh @erodewald @emax77 @drxeno02 @Plinzen ,

Please see if SDK release 2.12.5 fixes this issue for you.

You may see all changes in the changelog

tvanmanh commented 5 years ago

Hi @minbi although i updated SDK to 2.12.5 or 2.12.7, error still does occur.

Step to reproduce:

  1. I signed in app and then i Sign out with AWSMobleClient.getInstance.SignOut()
  2. I press sign in google/facebook button (signed in google/facebook account). it goes to facebook/google page and call back with "user canceled" error. but when i press the button again the result of call back is "signed in succeeded".

note: it means that if I sign out and want to sign in again. I have to press sign in button twice to sign in successfully. firsth: call back "user canceled" secondth: "signed in"

I'm waiting for your feedback.

minbi commented 5 years ago

Hi,

Please see if SDK release 2.13.2 fixes this issue for you. We have added the following bug fixes:

Fixed erroneous user cancelled error when redirecting back to app.

You may see all changes in the changelog

stale[bot] commented 5 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

shubhamssinghal commented 5 years ago

I am still getting the same issue with latest AWS SDK along with that at the time of sing out its throwing below exception " Access Token does not have required scopes " If anyone got the solution kindly please help me out Thank You

boldijar commented 4 years ago

I've found a fix, I've commented here https://github.com/aws-amplify/aws-sdk-android/issues/871#issuecomment-608355327