POST user does not set user_metadata

I’m making a request to create a user to https://[DOMAIN].eu.auth0.com/api/v2/users. I’ve followed the documentation here. I’ve sent the request via axios (nodejs) and Postman with the same result.

This creates the user, but does not set any user_metadata. Everything else is set, including app_metadata.

My request body:

{
    "name": "xxxx",
    "email": "jane.doe@example.com",
    "connection": "xxxx",
    "password": "xxxx",
    "user_metadata": {
        "hobby": "surfing"
    },
    "app_metadata": {
        "plan": "full"
    }
}

In auth0, the user does not have user_metadat and my response returns, amongst other things,

    "user_metadata": {},

I’ve been unable to figure out what I’m doing wrong here, and would appreciate some clarification. Thanks.

Hi @daniel.degrassi ,

Welcome to Auth0 Community!

We are looking into this query and will get back to you soon.

Hi @daniel.degrassi ,

I tested with axios (nodejs) and Postman and the user_metadata was added successfully. Your scripts look correct!

Do you have any rules or actions that could cause the user_metadata not inserted by the scripts?

Thanks!

1 Like

Apparently someone had previously set a hook that was using some context, which in our case was undefined, to overwrite what was sent in the request. Thanks for the quick response and the point in the right direction!

Thank you for the updates. Please feel free to reach us if any other queries.

Have a great rest of your day!

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