mizuko2か月前 00Auth0 Post-login ActionでのMFA制御JavaScriptAuth0Post-login Action内でユーザーのMFA設定を確認し、条件付きでGuardianを有効化する実装パターン: exports.onExecutePostLogin = async (event, api) => { // ユーザーのMFA設定を確認 if (event.user.app_metadata?.mfaEnabled) { // MFA認証済みかチェック const mfaAuthenticated = event.authentication?.methods?.find( (m) => m.name === "mfa" ); if (!mfaAuthenticated) { // GuardianでSMS MFAを要求 api.multifactor.enable("guardian"); } } }; エラーハンドリングとログ記録も実装し、MFA失敗時の適切な処理を行う。