How to delete amazon cognito user?
10,010
Solution 1
You can use the main aws javascript SDK and call the adminDeleteUser operation. It is an authenticated operation and it will require developer credentials for you to call it.
https://github.com/aws/aws-sdk-js/blob/master/apis/cognito-idp-2016-04-18.normal.json#L100
var aws = require('aws-sdk');
var CognitoIdentityServiceProvider = aws.CognitoIdentityServiceProvider;
var client = new CognitoIdentityServiceProvider({ apiVersion: '2016-04-19', region: 'us-east-1' });
//now you can call adminDeleteUser on the client object
Solution 2
You can do from AWS-CLI
aws cognito-idp admin-delete-user --user-pool-id ${user pool id} --username ${username usually email here}
Related videos on Youtube
Author by
Richardson. M
Programming is drawing your dreams in digital form.
Updated on June 04, 2022Comments
-
Richardson. M almost 2 years
I want to delete cognito user using my nodejs application.
ExamplecognitoUser.deleteUser (err, result) -> if err reject err resolve result
when i try to delete cognito user error throws as follows
Error: User is not authenticated
cognitoUser.deleteUser is used by an authenticated user to delete himself but i want to delete all users using super user
Please give me some idea to solve this problem.
-
Richardson. M almost 7 years@lonut Trestian, Thank you for your answer, i will try and let you know.