AWS Cognito-创建用户而不发送验证电子邮件

我正在尝试对某些注册了自己(管理员)的用户禁用验证过程。

我已经按照文档中的说明添加了预注册lambda

```exports.handler = (event,context,callback) => {

// Confirm the user
    event.response.autoConfirmUser = true;

// Set the email as verified if it is in the request
if (event.request.userAttributes.hasOwnProperty("email")) {
    event.response.autoVerifyEmail = true;
}

// Set the phone number as verified if it is in the request
if (event.request.userAttributes.hasOwnProperty("phone_number")) {
    event.response.autoVerifyPhone = true;
}

// Return to Amazon Cognito
callback(null,event);

};

并且电子邮件验证仍在向用户发送。

我还尝试过使用 adminconfirmSignUp API来确认用户,然后再通过 adminCreateUser 创建该用户。但这是我在使用 adminconfirmSignUp

时遇到的错误
  

{NotAuthorizedException:无法确认用户。当前状态为FORCE_CHANGE_PASSWORD

还有其他方法可以使我不向某些用户发送验证电子邮件吗?

erfaya 回答:AWS Cognito-创建用户而不发送验证电子邮件

我通过在创建用户时将这两个属性包含在请求中来使其工作。

DesiredDeliveryMediums: [],MessageAction: "SUPPRESS"

不需要预注册lambda。

本文链接:https://www.f2er.com/3088557.html

大家都在问