how to query user from userpool code example
Example: cognito listUser using amazon-cognito-identity-js
var AWS = require('aws-sdk');
exports.getUsers= () => {
var params = {
UserPoolId: USER_POOL_ID
AttributesToGet: [
'ATTRIBUTE_NAME',
],
};
return new Promise((resolve, reject) => {
AWS.config.update({ region: USER_POOL_REGION, 'accessKeyId': AWS_ACCESS_KEY_ID, 'secretAccessKey': AWS_SECRET_KEY });
var cognitoidentityserviceprovider = new AWS.CognitoIdentityServiceProvider();
cognitoidentityserviceprovider.listUsers(params, (err, data) => {
if (err) {
console.log(err);
reject(err)
}
else {
console.log("data", data);
resolve(data)
}
})
});
}