Created
June 5, 2018 17:07
-
-
Save prasadjay/1e3c31003417535468930b16be4393b7 to your computer and use it in GitHub Desktop.
Delete-User-Cognito
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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