'(aws-amplify / cognito) first name, last name and date of birth attributes to check if an account is associated with given values

By using Angular and aws-amplify, would it be possible to poll for an existing account in cognito if the only attribute that I am capturing are first name, last name and date of birth? This will pretty much void auth in a way.

Please note: Our application does not allow any new library to be imported. We are working with what we have.



Solution 1:[1]

Certainly it is possible to write a piece of code which queries user pool and informs if there is a match.

Alternative 1: Enable Amplify AdminQueries API and use listUsers to retrieve users. Command syntax allows using AttributesToGet and Filter to modify the query.

{
   "AttributesToGet": [ "string" ],
   "Filter": "string",
   "Limit": number,
   "PaginationToken": "string",
   "UserPoolId": "string"
}

Alternative 2: If possible, use Cognito API directly. @aws-sdk/client-cognito-identity-provider has the class ListUsersCommand. Its interface ListUsersCommandInput has properties AttributesToGet and Filter which can be used to fetch desired results.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1