Skip to content

Commit

Permalink
add user to customer group
Browse files Browse the repository at this point in the history
  • Loading branch information
italopessoa committed Sep 24, 2024
1 parent 6c2946b commit 3aee0e5
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ public async Task<Customer> 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;
Expand Down Expand Up @@ -91,6 +98,8 @@ public async Task<Customer> CreateAsync(Customer customer)
UserPoolId = _userPoolId,
});



if (response.Users.Count > 0)
{
var attributes = response.Users[0].Attributes;
Expand Down

0 comments on commit 3aee0e5

Please sign in to comment.