diff --git a/src/FIAP.TechChallenge.ByteMeBurger.Cognito.Gateway/CognitoUserManager.cs b/src/FIAP.TechChallenge.ByteMeBurger.Cognito.Gateway/CognitoUserManager.cs index 869a776..a241d3f 100644 --- a/src/FIAP.TechChallenge.ByteMeBurger.Cognito.Gateway/CognitoUserManager.cs +++ b/src/FIAP.TechChallenge.ByteMeBurger.Cognito.Gateway/CognitoUserManager.cs @@ -64,6 +64,13 @@ public async Task CreateAsync(Customer customer) } }); + await _cognitoClient.AdminAddUserToGroupAsync(new AdminAddUserToGroupRequest + { + UserPoolId = _userPoolId, + Username = customer.Cpf, + GroupName = "customer" + }); + logger.LogInformation("Customer successfully created."); customer.Id = Guid.Parse(signUpResponse.User.Attributes.First(a => a.Name is "sub").Value); return customer; @@ -91,6 +98,8 @@ public async Task CreateAsync(Customer customer) UserPoolId = _userPoolId, }); + + if (response.Users.Count > 0) { var attributes = response.Users[0].Attributes;