用户没有在电子邮件中收到临时密码。 我正在尝试使用lambda函数在cognito中创建用户。
'use strict'
const AWS= require('aws-sdk');
exports.handler = (event, context, callback) => {
console.log("event is ",event)
var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});
var params = {
UserPoolId: process.env.userpool,
Username: event.queryStringParameters.username,
DesiredDeliveryMediums: ['EMAIL'],
ForceAliasCreation: false,
MessageAction: 'SUPPRESS',
TemporaryPassword: '******',
UserAttributes: [
{
Name: 'email_verified',
Value: "true"
},
{
Name: 'email',
Value: event.queryStringParameters.email
},
{
Name: 'name',
Value: event.queryStringParameters.name
}
]
};
cognitoidentityserviceprovider.adminCreateUser(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
var response = {
"statusCode": 200,
"headers": {
"User": "Created successful",
"x-custom-header" : "my custom header value",
"Access-Control-Allow-Origin": "*"
},
"body": JSON.stringify(data),
"isBase64Encoded": false
};
callback(null, response);
});
};
答案 0 :(得分:1)
这是因为您正在使用MessageAction: 'SUPPRESS'
。删除它,将发送适当的电子邮件。