i have the following action when logging in:
exports.onExecutePostLogin = async (event, api) => {
const user = event.user;
const organization = event.organization;
const userRequire2fa = user.app_metadata && user.app_metadata.require2fa;
const orgRequire2fa = organization?.metadata.require2fa;
//TODO access users organization metadata. on current approach organization is undefined
if (orgRequire2fa||userRequire2fa) {
console.log(organization)
api.multifactor.enable("any")
}
};
by testing that in the Actions playground it reads the event.organization and the metadata I put there. but when testing with a real org and user associated, it is undefined
this is what is logged in auth0 actions:
{
"action_name": "require2fa",
"response": {
"logs": "undefined\n",
"stats": {
"total_request_duration_ms": 1723,
"total_runtime_execution_duration_ms": 1719,
"runtime_processing_duration_ms": 1373,
"action_duration_ms": 211,
"runtime_external_call_duration_ms": 135,
"boot_duration_ms": 1508,
"network_duration_ms": 5
}
},
"started_at": "2023-07-05T17:26:38.412329876Z",
"ended_at": "2023-07-05T17:26:40.136760544Z"
}