Reputation: 23256
I created the user using adminCreateUser. On trying to authenticate using adminInitiateAuth, a challenge NEW_PASSWORD_REQUIRED
is returned. How do I change the password?
I am trying to reset the user password for a user with status FORCE_CHANGE_PASSWORD
, using the following snippet:
cognitoidentityserviceprovider.respondToAuthChallenge({
ChallengeName: 'NEW_PASSWORD_REQUIRED',
ClientId:'XXXXXXXXXXXXXXXXXXXX',
ChallengeResponses: {
NEW_PASSWORD: 'T.YpkKu487',
USERNAME: 'XXXXX'
},
Session: "cMcKC5ymFvZG2D10lJMRArpfmLZvnQE25P1XjwkHtl47g4kW-LAjOgB4CAjIgv1CurDmfRHpxzvYgYE61BBrp5-TNyVQcXXX"
}, (err, data) => {
if(err) console.log(err);
else console.log(data);
});
When I run the above code, I get the following error:
InvalidParameterException: Invalid attributes given, name is missing
I do not understand this. Why am I getting this error? Reference doc
Also, is there a way I could disable this challenge altogether?
Upvotes: 2
Views: 901
Reputation: 111
Please add the 'name' attribute in your "userattributes" which you will pass for changing the password .
Upvotes: 0
Reputation: 342
Found A solution: When I created the user pool I added name and email as required attributes, creating it without requiring attribute name solved it.
Upvotes: 1