Amazon web services 使用Cognoto管理API创建用户

Amazon web services 使用Cognoto管理API创建用户,amazon-web-services,amazon-cognito,aws-userpools,Amazon Web Services,Amazon Cognito,Aws Userpools,我在Cognito中创建了一个用户池,名为“仅允许管理员创建用户”。现在我希望从我的react应用程序中添加用户,但我无法理解要调用哪些API来添加用户和第一次强制更改密码 此外,AWS Amplify是否为我们提供了创建管理员用户时使用的API。使用API创建用户。 AWS amplify具有以下演示代码,用于验证管理员创建的需要更改密码的用户: cognitoUser.authenticateUser(authenticationDetails, { onSuccess: f

我在Cognito中创建了一个用户池,名为“仅允许管理员创建用户”。现在我希望从我的react应用程序中添加用户,但我无法理解要调用哪些API来添加用户和第一次强制更改密码

此外,AWS Amplify是否为我们提供了创建管理员用户时使用的API。

使用API创建用户。 AWS amplify具有以下演示代码,用于验证管理员创建的需要更改密码的用户:

    cognitoUser.authenticateUser(authenticationDetails, {
    onSuccess: function (result) {
        // User authentication was successful
    },

    onFailure: function(err) {
        // User authentication was not successful
    },

    mfaRequired: function(codeDeliveryDetails) {
        // MFA is required to complete user authentication.
        // Get the code from user and call
        cognitoUser.sendMFACode(mfaCode, this)
    },

    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;

        // Get these details and call
        cognitoUser.completeNewPasswordChallenge(newPassword, userAttributes, this);
    }
});