Hello,
I have been trying to implement a way to force a new MFA enrollment on next login after an MFA Reset.
The only two ways we have found is either :
Force the MFA everytime → Not something we want to do (we would like to continue using the adaptive MFA)
Use a custom action (a template already exists
)- (
No built-in functionality in Auth0 apparently)
exports.onExecutePostLogin = async (event, api) => {
if (event.user.multifactor?.length) {
api.multifactor.enable('any', { allowRememberBrowser: false });
}
};
Problems with this code are :
It overrides the genral configuration for the tenant, so if my Dev tenant disables the MFA globally, this code will enforce it → I understand this is by design, so I need more intelligence to that
It also applies to user who are not using the MFA
What I tried then :
exports.onExecutePostLogin = async (event, api) => {
console.log(JSON.stringify(Object.keys(event.user)));
if (!!event.user.multifactor_last_modified && event.user.multifactor?.length) {
api.multifactor.enable('any', { allowRememberBrowser: false });
}
};
But even though the multifactor_last_modified is documented here User Profile Structure - Auth0 Docs as part of the properties available on the user, it seems there Actions Triggers: post-login - Event Object - Auth0 Docs that it is apparently just not available for the Actions…
(Even though I read there Actions multifactor property missing from event - Auth0 Community that it used to be)
Is that a bug or a missing feature that should have been there from the beginning ?
The only mean to achieve what I want would be using extra user metadata to ensure the action would only trigger when I want ; When integrating with backend application like ourselves, it adds complexity that could have been leveraged by Auth0.
What I am missing :
multifactor_last_modified in the user properties in action event- OR
a “Post MFA reset“ trigger to apply the logic of pushing extra metadata to the user in there
Any plans to any of both ?
Did I miss something obvious ? ![]()
Many thanks for your help