Auth0 Home Blog Docs

Can I add a fixed value to user_metadata when a user does self sign-up?

lock
signup
user
user_metadata

#1

I am using Lock library for login and sign-up. I’d like to have a some information added to the user_metadata at sign-up where the user isn’t prompted for nor even sees the information. I have some additionalSignUpFields defined and those get added perfectly to the user_metadata so I’d be happy if there was a way to add hidden fields with fixed prefill values under additionalSignUpFields.


#2

Currently, Lock does not have built-in support for hidden additional signup fields. You could hack around it by programmatically hiding them based on the CSS class generated from the provided name during the "signup ready" event raised by Lock. However, have in mind that the CSS class designation could change in a future version of Lock as there is no formal support for manipulation of Lock 10 through CSS class overrides and this hack would likely include some visual glitches due to the hiding of an already shown element.

I would recommend to raise this situation in the Lock GitHub repository in order to clarify if hidden fields would be something that could be supported. You can even confirm if a PR for such a feature would be welcome and considered to be included in Lock; if you have a positive answer there’s a previous PR that added the checkbox input type that can be used as reference.


#3