Skip to content

Instantly share code, notes, and snippets.

@prasadjay
Created June 5, 2018 17:07
Show Gist options
  • Save prasadjay/1e3c31003417535468930b16be4393b7 to your computer and use it in GitHub Desktop.
Save prasadjay/1e3c31003417535468930b16be4393b7 to your computer and use it in GitHub Desktop.
Delete-User-Cognito
function DeleteUser() {
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails({
Username: username,
Password: password,
});
var userData = {
Username: username,
Pool: userPool
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
cognitoUser.deleteUser((err, result) => {
if (err) {
console.log(err);
} else {
console.log("Successfully deleted the user.");
console.log(result);
}
});
},
onFailure: function (err) {
console.log(err);
},
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment