Auth0 Home Blog Docs

Error when trying to create user

Hello, when I’m trying to create a user via management api using the auth0 SDK for .NET, I’m getting this error:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /users</pre>
</body>
</html>

This is the code:

    var token = await _authService.GetToken();

     var client = new ManagementApiClient(token, new Uri(_configuration["Auth:Domain"]));

      await client.Users.CreateAsync(new UserCreateRequest
      {
           Email = request.Email,
           FullName = request.Email,
           Password = _configuration["Auth:DefaultPassword"],
           EmailVerified = false
      });

And I allowed all the scopes on my API

If someone needs more information to investigate, let me know.

Thanks

Hey there @lucasrocha!

Unfortunately I don’t have .NET experience apart from waiting for response here I suggest raising a GitHub issue in appropriate repo so that the tool maintainers can address your issue more reactively?

Thank you!

Hi,
were you able to resolve the issue. I am stuck at similar issue as well…

Update: Resolved.
instead of uri i passed just the domain into the constructor of the management api. that resolved it for me. Hope this helps others.

1 Like

Thank you @mmohanan for sharing it with the rest of community!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.