Application cannot be used for user registration

When I try to create user from the endpoint https://my_tenant.eu.auth0.com/api/v2/users I get the following response:

{“statusCode”:400,“error”:“Bad Request”,“message”:“Sandbox Error: App ‘My_App’ cannot be used for user registration.”}

In the Auth0 Management API section, Machine to Machine Applications My_App (Blazor Server web application) is correctly authorized to use managment API ad to create users

Hi @gianluca.biasini,

Welcome to the Auth0 Community!

Can you post the request you are making? In addition, you can confirm that the client ID, domain, and scopes are all correct?

1 Like
    NewAuth0User user = new NewAuth0User
    {
        email = "mymail@gmail.com",
        blocked = false,
        email_verified = false,
        given_name = "MyName",
        family_name = "MySurname",
        name = "MyName MySurname",
        nickname = "myNick",
        picture = "https://secure.gravatar.com/avatar/15626c5e0c749cb912f9d1ad48dba440?s=480&r=pg&d=https%3A%2F%2Fssl.gstatic.com%2Fs2%2Fprofiles%2Fimages%2Fsilhouette80.png",
        user_id = "abcd12345",
        verify_email = false,
        password = "mypassword",
        app_metadata = new { },
        user_metadata = new { },
        connection = "Username-Password-Authentication"
    };

var client = new RestClient(“https://mytenant.eu.auth0.com/api/v2/users”);
var request = new RestRequest(Method.POST);
request.AddHeader(“authorization”, $“Bearer {mytoken}”);
request.AddJsonBody(user);
return await client.ExecuteAsync(request);

Yes… I use the same to get all users… and it works fine

Can you please DM me the name of your tenant so I can look at the logs?

Sure… the tenant name is dev--z8ui6zz

I don’t see a machine to machine app authorized for the management API in your tenant.

It looks like this error is coming from one of your Pre registration actions. This makes sense, as I can’t find any record of this error message otherwise.

In pre-registration actions, I prevent people to sign in.

I need that only administrator is able to create users

I think this is the issue

You will need to add the name of the application to the allowedApps array in the Action.

Thank you… It worked!!!

1 Like