AWS Cognito Batch Query

Viewed 475

Is it possible to query AWS cognito with a list of user ids? Let's say i have user ids List : userid1,userid2,userid3,userid4,userid5,userid6

I know how to get an users one by one using their id or email address, but I was wondering if it is possible to get the users in a batch query using their ids or emails.

I use golang, but I can use any other language thanks in advance.

2 Answers

You can't do it directly, but maybe you could use https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ListUsers.html with a filter condition, but it has this limitation:

You can only search for the following standard attributes:

  • username (case-sensitive)

  • email

  • phone_number

  • name

  • given_name

  • family_name

  • preferred_username

  • cognito:user_status (called Status in the Console) (case-insensitive)

  • status (called Enabled in the Console) (case-sensitive)

  • sub

Custom attributes are not searchable.

Mostly filter won't work, because it only supports 2 conditions: "=" and "begin with".

I guess you have to use promise.all()

Related