Optionaloptions: MfaPollingOptionsMfaPollingOptions specifying the polling interval,
success callback (onCompleted), and optional error handler (onError).
object MfaPollingResult containing:
isRunning — true while polling is active.startPolling() — starts or resumes polling.stopPolling() — stops polling immediately.mfa-push-challenge-pushreset-password-mfa-push-challenge-pushmfa-push-enrollment-qrpending-consentimport { useMfaPolling } from '@auth0/auth0-acul-react/mfa-push-challenge-push';
export function MfaPushStatus() {
const { isRunning, startPolling, stopPolling } = useMfaPolling({
intervalMs: 5000,
onCompleted: () => console.log('Push approved!/denied'),
onError: (error) => console.error('Polling error:', error)
});
return (
<div>
<button onClick={startPolling} disabled={isRunning}>
{isRunning ? 'Waiting for approval…' : 'Start MFA Polling'}
</button>
{isRunning && <button onClick={stopPolling}>Cancel</button>}
</div>
);
}
onError callback receives an ULError object
with code and message describing the failure.429) are automatically handled:
polling waits for the reset window before retrying.startPolling() repeatedly while running is safe and idempotent.
React hook to manage polling on an Auth0 Advanced Customization of Universal Login (ACUL) screen that waits for an out-of-band decision, such as an MFA push notification approval or a pending consent.
This hook sets up and controls a long-running polling loop that repeatedly checks the current screen until one of the following occurs:
options.onCompleted.options.onError. Polling then stops and does not retry.stopPolling()is called, which cancels polling.Key Features
isRunningis reactive — it updates automatically if the polling loop stops internally or is canceled.useRef) to prevent duplicate network calls and unintended restarts during React re-renders.