SDK does not handle RESET_REQUIRED state
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:
- Import a user in cognito pool make sure that the state of user is RESET_REQUIRED
- Call the AWSMobileClient.getInstance().signIn() API with correct parameters
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):
- AWS Android SDK Version: 29
- Device: Simulator
- Android Version: Nougat
- Specific to simulators: No
Additional context Add any other context about the problem here.
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.