amazon-archives / amazon-cognito-identity-js

Amazon Cognito Identity SDK for JavaScript
Other
985 stars 454 forks source link

verifySoftwareToken fails with InvalidParameterException #627

Closed jamie-digital closed 6 years ago

jamie-digital commented 6 years ago

I'm trying to enable MFA with a TOTP software device for a signed-in user.

In summary either:

Happy to provide more info if it would be useful.

itrestian commented 6 years ago

I think I understand what the issue is and adding a check for session being returned after the verify software token call should solve the issue (it wouldn't respond to auth challenge after) as you pointed out. Does the verifySoftwareToken API fail consistently or only once in a while as would be expected from a time based OTP?

jamie-digital commented 6 years ago

cognitoUser.verifySoftwareToken fails consistently when adding the TOTP device. The API call to VerifySoftwareToken is succeeding every time, but cognitoUser.verifySoftwareToken is always performing the RespondToAuthChallenge API call, which fails. It's worth noting that I'm not seeing an auth challenge everywhere, so I'm not sure what the RespondToAuthChallenge is in response to.

I'm afraid I don't quite understand what you mean by adding a check for session being returned; is this in my code or within the SDK?

Thanks for your help.

itrestian commented 6 years ago

Got it! This should be fixed in the newest version 1.29.0. Fix is within the SDK that was making the unnecessary call.

jamie-digital commented 6 years ago

Fantastic! This fixes the issue for me. Thanks a lot for your help.