Fixed the bug that made DEVICE_PASSWORD_VERIFIER for remembered device fail #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you have enabled device remembering feature in you User Pool, this SDK will fail in response to
DEVICE_PASSWORD_VERIFIER
challenge, which occurs on the second time you login with the same device. Here is the error response from AWS:This is because when you first time login with this device, it sends the WRONG
PasswordVerifier
JSON parameter in theAWSCognitoIdentityProviderService.ConfirmDevice
request. This doesn't fail, which means you will be able to login the first time, but it is sending a WRONG parameter (hash based of the combination of device key, device group key and a random string), so AWS Cognito remembers the WRONG information. Consequently, the second time when the SDK sends a parameterPASSWORD_CLAIM_SIGNATURE
in theDEVICE_PASSWORD_VERIFIER
phase using the CORRECT device key and device group key to generate that hash, hence the conflict.More details from my blog if anyone is interested.