I need to get the Federated Identity Id for a Cognito Identity Pool user.
My dynamodb tables use userId as the primary key, where userId is the Cognito Federated Identity Id (configured using mobilehub). In an android app, I make a query using an AmazonCognitoIdentityProviderClient (which is properly instantiated with the IdentityManager and uses CognitoUserPoolsSignInProvider & FacebookSignInProvider) -- this query successfully retrieves all of the users in my cognito user pool (I do use a filter, but have removed it for simplicity, here):
ArrayList<UserType> cognitoPoolUsers = instantiatedAmazonCognitoIdentityProviderClient().listUsers().getUsers();
The users in cognitoPoolUsers have attributes like email and username, but the userId that is used for the dynamo primary key is the userId of the federated user that is linked to the cognitoPoolUser.
How can I retrieve the corresponding federated identity userId, given that I have successfully retrieved the list of cognitoPoolUsers?
End goal (I would actually use batchLoad, but for simplicity..):
ArrayList<UserType> cognitoPoolUsers = instantiatedAmazonCognitoIdentityProviderClient().listUsers().getUsers();
for(int k=0; k<cognitoPoolUsers.size(); k++) {
UserType cognitoPoolUser = cognitoPoolUsers.get(k);
SomeDynamoDO dynamoDO = new SomeAmazonDO();
//Unknown Step:
String correspondingFederatedId = extractFederatedId(cognitoPoolUser);
dynamoDO.setUserId(correspondingFederatedId)
dynamodbMapper.load(dynamoDO)
}