I am unable to add app_metadata to a user using a Rule. I attempted to use the boilerplate code I found here in the docs:
function (user, context, callback) {
user.app_metadata = user.app_metadata || {};
// update the app_metadata that will be part of the response
user.app_metadata.test = "test!";
// persist the app_metadata update
auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
.then(function(){
callback(null, user, context);
})
.catch(function(err){
callback(err);
});
}
I receive the following error:
ERROR: The user does not exist.
What am I doing wrong here?