Skip to main content

isUserMissingMfaAuth

Checks if the user requires additional MFA authentication. This function determines if the current user session requires additional multi-factor authentication to access certain features. This is typically used with session-based MFA to verify if a user needs to complete an MFA challenge. The function checks for the presence of the requiresAdditionalAuth scope in the user’s JWT token.

Usage

Parameters

Returns

boolean - Returns true if the user needs additional MFA authentication, false otherwise.

Examples

Check and prompt for MFA

Protect sensitive actions

Conditional UI rendering

Listen for auth state changes

How it works

The function checks if the user’s JWT token contains the requiresAdditionalAuth scope:
This scope is added by the Dynamic backend when:
  • Session-based MFA is enabled and required
  • The user has not yet completed an MFA challenge for the current session
  • The user is required to set up MFA but hasn’t done so yet

Error handling

The function throws an error if the user is not logged in:

React

isUserMissingMfaAuth() is synchronous — call it directly during render. Pair it with useUser() so your component re-renders after MFA is completed:
Last modified on July 8, 2026