amazon-cognito-identity-js
amazon-cognito-identity-js copied to clipboard
Verification code timeout
I have a very strange bug :
If users directly try to confirm them account with the verification code received by email they always have this error message : "ExpiredCodeException: Invalid code provided, please request a code again" eventhough them account is well confirmed in the user pool...
But If they register themselves and they wait few minutes to try to confirm them account its works perfectly !
This is how I confirm the verification code :
confirmRegistration: function(verificationCode, username, _poolData) {
var deferred = $q.defer();
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(_poolData);
var userData = {
Username : username,
Pool : userPool
};
cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.confirmRegistration(verificationCode, true, function(err, result) {
if (err) {
alert(err);
deferred.reject('confirmation failled.');
}
deferred.resolve('successfully confirmed.')
});
return deferred.promise;
},
How could I fixe it ? Where is from this problem ? Do there is a timeout to set somewhere ?
Confirmation and verification code are valid for 24 hours and this is not configurable at the moment ...
Thanks for your answer @itrestian but that not my problem. The problem is than I have a message eror if I try to validate a verification code just after receive it. To don't have an error message I have to wait almost 1 minute after received the verification code to validate it... Why ?
Same issue here except I'm using node-js sdk.