isPendingRecoveryCodesAcknowledgment
Checks if the user is still pending acknowledgment of their MFA recovery codes.
This function determines whether the user has been presented with recovery codes that they have not yet acknowledged as saved or backed up. When MFA is set up, users receive recovery codes that can be used to regain access if they lose their MFA device. It’s important to ensure users acknowledge these codes before proceeding.
Usage
Parameters
Returns
boolean - Returns true if recovery codes are pending acknowledgment, false otherwise.
Examples
Prompt user to acknowledge recovery codes
Block access until acknowledgment
Conditional UI rendering
Check during onboarding
Listen for user state changes
How it works
The function checks the user’s mfaBackupCodeAcknowledgement status:
The status can be:
pending: User has been given recovery codes but hasn’t acknowledged them
complete: User has acknowledged their recovery codes
null or undefined: Treated as pending (user hasn’t explicitly completed acknowledgment)
The function returns true for any status that is not explicitly complete, ensuring users must actively acknowledge their recovery codes.
When does this apply?
This check is relevant when:
- A user has set up MFA for the first time
- A user has created new recovery codes
- MFA is required by your application settings
If MFA is not enabled or the user hasn’t set up MFA, this will typically return false.
Error handling
The function throws an error if the user is not logged in:
React
isPendingRecoveryCodesAcknowledgment() is synchronous — call it during render. Pair it with useUser() so the component re-renders once the user acknowledges their codes:
Last modified on July 8, 2026