登录和登录 Amazon Web Service Cognito 错误消息

Login and Signin to Amazon Web Service Cognito error messages

我正在使用 Cognito AmazonWebService 和 AngularJS 进行我的应用程序用户管理。

我不知道如何解决这个问题:

注册后,用户会收到一封电子邮件,其中包含用于确认的代码。当我尝试输入并验证代码时,我有一条弹出消息说“Error: the user is not authenticated”。

但是,如果我交换步骤,我无法验证自己,因为我有这个错误:"Your account must be confirmed"

编辑:这就是我确认注册的方式:

var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(_poolData);
    var userData = {
     Username : username,
     Pool : userPool
        };
            var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
            cognitoUser.getAttributeVerificationCode('email', {
    onSuccess: function (result) {
        console.log('call result: ' + result);
    },
    onFailure: function(err) {
                    console.log("error");
        alert(err);
    },
    inputVerificationCode: function(code) {
                var verificationCode = prompt('Check you email for a verification code and enter it here: ' ,'');
            cognitoUser.verifyAttribute('email', verificationCode, this);
             }
        });

我也试过下面这段代码:

var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.confirmRegistration('123456', true, function(err, result) {
    if (err) {
        alert(err);
        return;
    }
    console.log('call result: ' + result);
});

但每次我使用您给我的代码来确认用户时,我都会收到此错误消息:"ExpiredCodeException: Invalid code provided, please request a code again." 而用户在我的用户池中得到了很好的确认...

我该如何解决?

你的第二个代码是正确的。您要等多久才能打电话?