Creating a user via the Management API results in a HTTP 400 error

Problem statement

We are trying to create a user via the Auth0 Management API, using the call described in the documentation:

However, the call fails and we get presented with the following error:

2023-02-03T12:21:39.784364757Z: [INFO] com.auth0.exception.APIException: Request failed with status code 400: connection is disabled (client_id: XXX123edassafewfxdcxz`xsaalcyGabcGGln6GXRuIK1Nbh4tXYYY - connection: demo-dB )

‘demo-dB’ is a regular Auth0 username-password database within our tenant. We get this error even though the connection is indeed enabled for our organisation and creating a user via the Auth0 dashboard is working fine.

Why might we be experiencing this problem?

Symptoms

Any attempt to create a user via the Management API for the target connection ( in this case ‘demo-dB’ ) will throw an error of the type ‘Request failed with status code 400: connection is disabled’.

However, attempts to use the Management API to create users on other Auth0 username-password connections may well succeed without error.

Cause

The signup attempted failed because the client application that the you wanted to signup for has no association with the desired Auth0 username-password database connection.

Solution

In order to fix this problem, you need to link the application with the connection. You can do this from the dashboard:

Authentication → Database → demo-dB → Applications [ select from the menu ] where ‘demo-dB’ is the name of the connection in this particular case.

Then toggle the slider next to the application name to enable access to the connection. The next time you try to signup a user from within the application, there should be no error.

Attempting to create a user via the Management API should now also work.