【问题标题】:AWS Cognito - Create user without sending them a verification emailAWS Cognito - 创建用户而不向他们发送验证电子邮件
【发布时间】:2020-03-12 16:19:44
【问题描述】:

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

我已经添加了注册前 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);

};

电子邮件验证仍在发送给用户。

我还尝试在使用 adminCreateUser 创建用户后立即使用 adminConfirmSignUp api 来确认用户。但这是我在使用 adminConfirmSignUp

时遇到的错误

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

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

【问题讨论】:

    标签: javascript node.js amazon-web-services amazon-cognito


    【解决方案1】:

    我通过在创建用户时在请求中包含这两个属性来实现这一点。

    DesiredDeliveryMediums: [],
    MessageAction: "SUPPRESS"
    

    无需预先注册 lambda。

    【讨论】:

      猜你喜欢
      • 2018-03-02
      • 1970-01-01
      • 2020-05-13
      • 2019-05-11
      • 2020-08-06
      • 2012-07-14
      • 2018-02-17
      • 1970-01-01
      • 2021-05-12
      相关资源
      最近更新 更多