I have a Pre User Registration hook that sets a custom field is_approved to user. and this is the code:
module.exports = function (user, context, cb) {
var response = {};
response.user = user;
// Add user or app metadata to the newly created user
// Adding is_approved attribute to app_metadata and setting it to false
response.user.app_metadata = { is_approved: false };
// Continue with the response
cb(null, response);
};
Since hooks are going to be deprecated, I want to create use actions. So I created this action:
This should add is_approved field to app metadata in username/password logins, but it does not add. In addition, I added another Action to add this field in social logins:
This code should work - Do you have any hooks or rules enabled that could be interfering? I would double check to see if you have any enabled, and if you do remove them and test again.
I’m having a hard time coming up with anything else to check - Is the user you are registering a Auth0 database user or social (google, facebook, etc.), passwordless, etc.?
Hey @mahdi1 no problem, happy to help where I can!
Thanks for confirming - Only the Post Login Action will run on Social logins. The Post Login Action code you shared above seems to be working in my environment when logging in for the first time with a Google user: