amazon-archives / amazon-cognito-identity-js

Amazon Cognito Identity SDK for JavaScript
Other
986 stars 452 forks source link

MissingRequiredParameter: Missing required key 'Password' in params #616

Closed jonathan-kosgei closed 6 years ago

jonathan-kosgei commented 6 years ago

I get the above error from the following, even though the code eventually works and the user is created.

var poolData = {
        UserPoolId : 'us-east-1_mrk4RyjYz', // Your user pool id here
        ClientId : '6upe6ndundkv7f5i9jlo6a8p2t' // Your client id here
    };
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);

var attributeList = [];

var dataEmail = {
    Name : 'email',
    Value : values.email
};

var attributeEmail = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserAttribute(dataEmail);

attributeList.push(attributeEmail);

userPool.signUp(values.email, values.password, attributeList, null, function(err, result){
    if (err) {
        alert(err);
        return;
    }
    cognitoUser = result.user;
    console.log('User name is ' + cognitoUser.getUsername());
});
});
})
})
jonathan-kosgei commented 6 years ago

My code was outside the wrong curly brackets so values wasn't defined for it. Fixed.