How to change User Status FORCE_CHANGE_PASSWORD?

前端 未结 12 1935
我在风中等你
我在风中等你 2020-12-07 08:15

Using AWS Cognito, I want to create dummy users for testing purposes.

I then use the AWS Console to create such user, but the user has its status s

12条回答
  •  情歌与酒
    2020-12-07 08:39

    Just add this code after your onSuccess: function (result) { ... }, within your login function. Your user will then have status CONFIRMED.

    newPasswordRequired: function(userAttributes, requiredAttributes) {
        // User was signed up by an admin and must provide new
        // password and required attributes, if any, to complete
        // authentication.
    
        // the api doesn't accept this field back
        delete userAttributes.email_verified;
    
        // unsure about this field, but I don't send this back
        delete userAttributes.phone_number_verified;
    
        // Get these details and call
        cognitoUser.completeNewPasswordChallenge(newPassword, userAttributes, this);
    }
    

提交回复
热议问题