I need to check that a user-provided input matches the current password (from Cognito User Pool). I'm implementing a confirmation dialog that requires the user to provide their password again (user must be logged in to access this functionality), and check if it's valid.
I am using the AWS SDK for Java on Android and the current implementation does the following:
getUserPool() // com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUserPool
.getCurrentUser()
.changePasswordInBackground(
password, // oldUserPassword
password, // newUserPassword
new GenericHandler() {
@Override
public void onSuccess() {
// provided password is correct
}
@Override
public void onFailure(Exception e) {
// provided password is incorrect
}
}
);
However, this feels like a hack, and is subject to Failed Attempt Limits, which makes automating some test cases unfeasible.
Is there an API within the SDK that I can use for this?
Thank you!