Hi Auth0 Community
I successfully created a rule based on the Remove attributes from user template
function removeUserAttribute(user, context, callback) {
const blacklist = ['nickname','picture'];
Object.keys(user).forEach(function (key) {
if (blacklist.indexOf(key) > -1) {
delete user[key];
}
});
callback(null, user, context);
}
I migrated the code to a Login Flow action script.
exports.onExecutePostLogin = async (event, api) => {
const blacklist = ['nickname','picture'];
Object.keys(event.user).forEach(function (key) {
if (blacklist.indexOf(key) > -1) {
delete event.user[key];
}
});
return;
};
The rule works, but the action script doesn’t. What have I done wrong?
Kind regards
Richard