Auth0 Home Blog Docs

Multiple Bugs

management-api
error
user
api
bugs

#1

bug 1)
I try to add a user, I get a response ‘‘already exists’’,
when I do this, afterwards I try to get the user and link to the existing user in my code.

private static async Task<ManagementApiClient> GetAuth0Client()
{
        //create a token
       ......
       return new ManagementApiClient(token, "mycompany.eu.auth0.com");
}

public void CreateUser(CreateUserModel myQueueItem)
{
    var createrequest = new UserCreateRequest()
    {
        Email = myQueueItem.Email,
        EmailVerified = false,
        FirstName = myQueueItem.GivenName,
        LastName = myQueueItem.FamilyName,
        Password = myQueueItem.Password,
        Connection = "Mediapulse",
        VerifyEmail = true,
    }; 

try
{
var result = await (await GetAuth0Client()).Users.CreateAsync(createrequest);
}
catch (Exception ex)
{
   if (ex.Message.Contains("already exists"))
   {
      var result = (await (await 
      GetAuth0Client()).Users.GetAllAsync())
      .SingleOrDefault(x => x.Email == myQueueItem.Email); 
      //the result is null..
      var contact = GetContactByEmail(myQueueItem.Email);
      contact.Auth0Id = result.UserId; //throws exception 
   } 
}
}

but… when I look in the user list, it does not exist.

bug 2)
the C# client.users.deleteallasync returns a 404… the api endpoint mightve been changes, or the C# client isn’t up to date?


#2