AWS Cognito Example using SDK for JavaScript (v3)

Suman Dev
Jun 22, 2023

import { CognitoIdentityProviderClient } from "@aws-sdk/client-cognito-identity-provider";

export const cognitoCreateUser = async () => {
try {
const cognitoClient = new CognitoIdentityProviderClient({ region: 'Your AWS Region'});
const params = {
UserPoolId: 'Your Pool Id',
Username: 'Your Username',
UserAttributes: 'Your User Attributes',
DesiredDeliveryMediums: ["EMAIL"],
};
const command = new AdminCreateUserCommand(params);
return cognitoClient.send(command);
} catch (err) {
throw err;
}
}

For further reference , please look in to this AWS Docs

--

--