Auth0 Home Blog Docs

Nested additionalSignUpFields

signup
additionalsignupfiel

#1

How can I nest additional fields with lock for web version 10.23?

We tried the following with no positive results:

additionalSignUpFields:

    {
        name: "mySettings",
        placeholder: "Settings",
        prefill: { "interest": "20"}
    }
]

additionalSignUpFields:

    {
        name: "mySettings.interest",
        placeholder: "Settings",
        prefill: "20"
    }
]

We need the user metadata to look like this:

"user_metadata": {
    "mySettings": {
        "interest": "20"
    }
}

When the user signs up these settings should be set in his account.


#2

That is not supported in the underlying API used to signup end-users so there is also not support within the Lock option that leverages that same API. In particular, from the API docs:

user_metadata - The user metadata to be associated with the user. If set, the field must be an object containing no more than ten properties. Property names can have a maximum of 100 characters, and property values must be strings of no more than 500 characters.

(emphasis is mine)

Each additional user metadata property at signup time cannot be an object, however, you can consider if the use of a pre-registration hook to reorganize the user metadata would be a suitable complement to the overall solution. If suitable the hook would be the best place to do it, however, you could always re-arrange metadata in a rule.


#3