cognito listuser using amazon cognito identity js

Solutions on MaxInterview for cognito listuser using amazon cognito identity js by the best coders in the world

showing results for - "cognito listuser using amazon cognito identity js"
Isabell
06 Jul 2018
1var AWS = require('aws-sdk');
2
3exports.getUsers= () => {
4	var params = {
5	  UserPoolId: USER_POOL_ID
6	  AttributesToGet: [
7	    'ATTRIBUTE_NAME',
8	  ],
9	};
10	
11	return new Promise((resolve, reject) => {
12		AWS.config.update({ region: USER_POOL_REGION, 'accessKeyId': AWS_ACCESS_KEY_ID, 'secretAccessKey': AWS_SECRET_KEY });
13		var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
14		cognitoidentityserviceprovider.listUsers(params, (err, data) => {
15			if (err) {
16				console.log(err);
17				reject(err)
18			}
19			else {
20				console.log("data", data);
21				resolve(data)
22			}
23		})
24	});
25}