MFA for external login

Hi Rueben,

Thanks for your reply. I’m trying to use the post login action, and I’m not sure if the following realiable.

Does the authentication method from external login available in the event (I’m using Okta in this case.)?

exports.onExecutePostLogin = async (event, api) => {
    const authMethods = event.authentication?.methods || [];
    const completedMfa = authMethods.find((method) => method.name === 'mfa');

    if (!completedMfa) {
        api.multifactor.enable('any', { allowRememberBrowser: true });
    }
};