In the online managament API from Auth0 i can create a user with this body. But here somehow the CreateAsync is not working.
private async Task CreateUserAuth0()
{
var newRequest = new Auth0.ManagementApi.Models.UserCreateRequest
{
Connection = "Username - Password - Authentication",
Email = "[email protected]",
Password = "Test123456"
};
var response = await _managementApiClient.Users.CreateAsync(newRequest);
}
The Update and Delete calls are working fine.
private async Task UpdateUserEmailAuth(string email, string newEmail)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Email = newEmail
});
}
private async Task UpdateUserPasswordAuth(string email, string password)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.UpdateAsync(user.UserId, new
Auth0.ManagementApi.Models.UserUpdateRequest
{
Password = password
});
}
private async Task DeleteUserAuth0(string email)
{
Auth0.ManagementApi.Models.User user = await GetUserAuth0(email);
await _managementApiClient.Users.DeleteAsync(user.UserId);
}
CodePudding user response:
Remove the spaces in the Connection property Username-Password-Authentication
. Since it's the name of the Auth0 Database, which cannot contain spaces.
Another issue can be that the password is not strong enough, check the internal server error of Auth0 in de log and the password rules for your application.