I am trying to create a new record on my database when a user successfully signs up on Auth0 using a email, password and a name field. I have enabled “Customize Login Page” inside Branding > Universal Login > Advanced > Login and added the following code to the LOCK template to get a name field when the user signs up.
additionalSignUpFields: [{
name: "name",
storage: "root",
placeholder: "Enter your full name"
}]
However, when I create a postUserRegistration Action, my api (linked to the Action postUserRegistration) does not get the name field.
I have tried disabling the “Customize Login Page” option and used just the default ULP experience still no difference. I should note that I am getting all the expected fields if I choose to use the PostLogin Action but that is not useful as per my requirement. Here is my attached postUserRegistration action.
const axios = require("axios");
exports.onExecutePostUserRegistration = async (event, api) => {
await axios.post("https://myapp.example.com", {email: event.user.email, name: event.user.name});
};
Hi @sumit.kumar,
Welcome to the Auth0 Community!
Are you seeing a name
field in the user profile after they log in?
Also, have you checked in the event.user.user_metadata
object?
@dan.woda
Are you seeing a name
field in the user profile after they log in?
Yes, As i mentioned the name field is visible in the PostLogin action (but not in the PostUserRegistration) and also in the raw_json inside Dashboard > UserManagement > Users.
Also, have you checked in the event.user.user_metadata
object?
Yes, the user_metadata object is available in the PostUserRegistration action but it is empty. I have attached a sample of the evemt.user object below
"user":{"email":"username@email.com","tenant":"tenant_name","user_id":"auth0|id","app_metadata":{},"user_metadata":{},"email_verified":false,"phone_verified":false},"configuration":{}
Hey there!
As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!
Learn more here!