in source/user-manager/cognito-user.js [106:131]
function getUserFromCognitoUser(cognitoUser, attributeList) {
var user = {}
try {
user.userName = cognitoUser.Username;
user.enabled = cognitoUser.Enabled;
user.confirmedStatus = cognitoUser.UserStatus;
user.dateCreated = cognitoUser.UserCreateDate;
attributeList.forEach(function (attribute) {
if (attribute.Name === "given_name")
user.firstName = attribute.Value;
else if (attribute.Name == "family_name")
user.lastName = attribute.Value;
else if (attribute.Name == "custom:role")
user.role = attribute.Value;
else if (attribute.Name == "custom:tier")
user.tier = attribute.Value;
else if (attribute.Name == "custom:email")
user.email = attribute.Value;
});
}
catch (error) {
winston.error('Error populating user from Cognito user: ', error);
throw error;
}
return user;
}