最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to delete amazon cognito user? - Stack Overflow

programmeradmin6浏览0评论

I want to delete cognito user using my nodejs application.
Example

cognitoUser.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.

I want to delete cognito user using my nodejs application.
Example

cognitoUser.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.

Share Improve this question asked Jun 20, 2017 at 5:23 Richardson. MRichardson. M 9322 gold badges17 silver badges31 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

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./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     

You can do from AWS-CLI

aws cognito-idp admin-delete-user --user-pool-id ${user pool id} --username ${username usually email here}
发布评论

评论列表(0)

  1. 暂无评论