要解决AWS Cognito Lambda PreSignup触发器错误地自动确认和自动验证用户的电子邮件的问题,您可以执行以下步骤:
import json
def lambda_handler(event, context):
# 确保事件是来自Cognito的PreSignup触发器
if event['triggerSource'] == 'PreSignUp_AdminCreateUser':
# 设置自动确认为false,确保用户的电子邮件需要手动确认
event['response']['autoConfirmUser'] = False
# 设置自动验证为false,确保用户的电子邮件需要手动验证
event['response']['autoVerifyEmail'] = False
# 返回修改后的事件对象
return event
通过以上步骤,您可以修复AWS Cognito Lambda PreSignup触发器错误地自动确认和自动验证用户的电子邮件的问题,并确保用户的电子邮件需要手动确认和验证。