How do I resolve 'Missing required property: connection' Error?

I am trying to create a user following the approach on the link below:
https://auth0.com/docs/metadata/apis#set-metadata-fields-on-creation

I get an error in response:
{“errorCode”:“invalid_body”,“error”:“Bad Request”,“message”:“Payload validation error: ‘Missing required property: connection’.”,“statusCode”:400}

The response doesn’t provide any meaningful information to resolve the issue.

Note I retrieved a token to pass in the create request following the documentation I found at https://auth0.com/docs/api/management/v2/tokens.

How can I go about finding the issue?

Hello @andy.adams,

The doc mentioned guides you to add user_metadata or app_metadata when creating a user, also you can update this data later using management API.

These two fields can be used to store additional information about the user.
Please refer this doc for more information.

Regarding the above-mentioned error :
As the doc suggests ‘connection’ is a required field for this call, perhaps you are missing that in the body.

Hope this helps!

The error means you’re missing the connection property in the body of your request. As stated in the [Create a user] (Auth0 Management API v2) management API documentation:

The attribute connection is always
mandatory but depending on the type of
connection you are using there could
be others too.

Taking the example from the [link] (Manage Metadata Using the Management API) you referenced and assuming a default database connection, a proper request body would look like:

{
    "email": "jane.doe@example.com",
    "password": "secret",
    "connection": "Username-Password-Authentication",
    "user_metadata": {
        "hobby": "surfing"
    },
    "app_metadata": {
        "plan": "full"
    }
}

Thanks for the replies above. I was able to get my example working after looking though the additional links provided above.

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