I need assistance with retrieving a list of matching users from a Cognito userpool using an ExpressJS API to verify if the username already exists. Here is the code snippet:
listUserFromUserpool = async () => {
var params = {
UserPoolId: process.env.USER_POOL_ID /* required */,
AttributesToGet: ["username"],
Filter: 'username = "example"',
Limit: 5,
PaginationToken: "What should I pass here initially?",
};
try {
let data = await this.cognitoIdentity.listUsers(params).promise();
return data;
} catch (error) {
console.log(error);
return false;
}
};
However, I'm encountering an error with the PaginationToken
. What value should I insert into the PaginationToken
parameter initially until I receive it in the next response?
Alternatively, is there a way to retrieve a single user without utilizing pagination?