aws-amplify / aws-sdk-android

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

SDK does not handle RESET_REQUIRED state #1377

Open santhedan opened 4 years ago

santhedan commented 4 years ago

Describe the bug The bug reported in amplify-js also exist in the Android SDK.

https://github.com/aws-amplify/amplify-js/issues/4516

To Reproduce A code sample or steps:

You will see the following exception in logcat:

com.amazonaws.services.cognitoidentityprovider.model.InvalidParameterException: Invalid input given (Service: AmazonCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: XXXXXXXXXXX) at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212) at com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProviderClient.invoke(AmazonCognitoIdentityProviderClient.java:6292) at com.amazonaws.services.cognitoidentityprovider.AmazonCognitoIdentityProviderClient.initiateAuth(AmazonCognitoIdentityProviderClient.java:4277) at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:2465) at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:124) at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1177) at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:778) at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1137) at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101) at java.lang.Thread.run(Thread.java:919)

Your code AWSMobileClient.getInstance().signIn() with correct parameters.

Which AWS service(s) are affected?

Expected behavior Expected is that the signInResult.getSignInState() should return NEW_PASSWORD_REQUIRED

Screenshots NA

Environment Information (please complete the following information):

Additional context Add any other context about the problem here.

TrekSoft commented 4 years ago

Hey @santhedan, looked into this a bit here and it seems the library is passing through the exception it's getting from the endpoint we are currently calling so we'd probably have to add an additional check before attempting to sign in if the user is in this state. Marking this as a feature request.