2
我試圖從AWS LAMBDAAWS Cognito adminCreateUser從LAMBDA
創建一個AWS用戶羣用戶我試圖與此腳本似乎是爲AWS官方JavascriptSDK了,但不能讓它工作。 http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#adminCreateUser-property
我不斷收到此錯誤:
TypeError: cognitoidentityserviceprovider.adminCreateUser is not a function
'use strict'
const AWS= require('aws-sdk');
exports.handler = (event, context, callback) => {
var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});
var params = {
UserPoolId: 'eu-west-1_XXXXXXXX', /* required */
Username: '[email protected]', /* required */
DesiredDeliveryMediums: [
'EMAIL'
],
ForceAliasCreation: false,
MessageAction: 'SUPPRESS',
TemporaryPassword: 'tempPassword1',
UserAttributes: [
{
Name: 'email', /* required */
Value: '[email protected]'
},
{
Name: 'name', /* required */
Value: 'Me'
},
{
Name: 'last_name', /* required */
Value: 'lastme'
}
/* more items */
]
};
cognitoidentityserviceprovider.adminCreateUser(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
callback(null, data);
});
};
謝謝,解決了這個問題! – danielebuso