Post registration and post login actions do not update app metadata

We have been using auth0 for awhile in our application, and we moved rules to actions awhile back and we realize it is not working as expected, meaning user app meta data is not updated.

for post registration,

exports.onExecutePostUserRegistration = async (event) => {

 event.user.app_metadata.sample_field = 'some field we want to update to'
}

for post login

exports.onExecutePostLogin = async (event, api) => {

api.user.setAppMetadata('sample_field', 'some field we want to update to')

}

User app metadata is not being updated either way, both actions are called and there is no error regarding any of the actions.

is this way of updating user app metadata no longer supported?

1 Like

Hi @mahder,

Welcome to the Auth0 Community!

You should not use a post reg action to update user metadata. Please see this FAQ for more details: Can I use a post-user registration action (or hook) to update a user?

You should be able to accomplish what you have described with a post-login action here. Let’s take a look at how you’ve set up your action.

Can you please DM me the name of the effected tenant so I can take a look?

1 Like

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!