I have a question that has been asked before, but I cannot see the answer im looking for.
I am using the auth0.js SDK to signup a user from a custom html form.
In my signup form I have a custom field named “company_name”.
I want to store this “company_name” in the users app_metadata.
But the auth0.signup function does not allow me to post app_metadata.
It only allows me to post user_metadata.
So after Googling for some hours without a solution, my only solution is some kind of a hack.
I can create a hook that creates app_metadata from the user_metadata on a Pre User Registration
module.exports = function (user, context, cb) {
var response = {};
response.user = user;
response.user.app_metadata = {company_name: user.user_metadata.company_name};
cb(null, response);
};
But there must be better solution than this?
There is another solution but that requires additional steps and does not work when a user signs up.
Like this one: https://auth0.com/docs/users/update-metadata-with-the-management-api#
Does anyone have any tips on how to solve this?