> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Check Onboarding Completion

# isUserOnboardingComplete

Checks if the user has completed all onboarding requirements including KYC fields and MFA setup.

This function verifies whether a user has fulfilled all necessary requirements to be considered fully onboarded:

* **KYC Fields**: All required Know Your Customer information fields have been provided
* **MFA Authentication**: User has completed any required multi-factor authentication challenges
* **Recovery Codes**: User has acknowledged their MFA recovery codes (if MFA is enabled)

Use this function to determine if you should direct users to complete additional onboarding steps or allow them full access to your application.

## Usage

```javascript theme={"system"}
import { isUserOnboardingComplete } from '@dynamic-labs-sdk/client';

const checkUserStatus = () => {
  const isComplete = isUserOnboardingComplete();

  if (isComplete) {
    console.log('User has completed all onboarding requirements');
  } else {
    console.log('User has pending onboarding requirements');
  }
};
```

## Parameters

| Parameter | Type                       | Description                                                             |
| --------- | -------------------------- | ----------------------------------------------------------------------- |
| `client`  | `DynamicClient` (optional) | The Dynamic client instance. Only required when using multiple clients. |

## Returns

`boolean` - Returns `true` if onboarding is complete (no pending requirements), `false` if there are pending requirements.

## Examples

### Basic onboarding check

```javascript theme={"system"}
import { isUserOnboardingComplete } from '@dynamic-labs-sdk/client';

const handlePostLogin = () => {
  const isComplete = isUserOnboardingComplete();

  if (!isComplete) {
    // Redirect to onboarding flow
    redirectToOnboarding();
  } else {
    // Allow access to main application
    redirectToDashboard();
  }
};
```

### Checking specific requirements

If you need to know which specific requirements are pending, you can check each requirement individually:

```javascript theme={"system"}
import {
  isUserOnboardingComplete,
  isUserMissingMfaAuth,
  isPendingRecoveryCodesAcknowledgment,
  getDefaultClient
} from '@dynamic-labs-sdk/client';

const checkOnboardingDetails = () => {
  const dynamicClient = getDefaultClient();
  const user = dynamicClient.user;

  if (!user) {
    console.log('User not logged in');
    return;
  }

  const isComplete = isUserOnboardingComplete();

  if (!isComplete) {
    // Check individual requirements
    const hasMissingKycFields = Boolean(user.missingFields?.length);
    const needsMfaAuth = isUserMissingMfaAuth();
    const needsRecoveryAcknowledgment = isPendingRecoveryCodesAcknowledgment();

    if (hasMissingKycFields) {
      console.log('User needs to complete KYC fields:', user.missingFields);
    }

    if (needsMfaAuth) {
      console.log('User needs to complete MFA authentication');
    }

    if (needsRecoveryAcknowledgment) {
      console.log('User needs to acknowledge recovery codes');
    }
  }
};
```

### Listen for user changes and check onboarding

```javascript theme={"system"}
import {
  isUserOnboardingComplete,
  onEvent
} from '@dynamic-labs-sdk/client';

// Listen for user changes and check onboarding status
onEvent({
  event: 'userChanged',
  listener: ({ user }) => {
    if (!user) return;

    const isComplete = isUserOnboardingComplete();
    console.log('Onboarding complete:', isComplete);

    if (isComplete) {
      // User completed all requirements, update UI
      showFullAccess();
    } else {
      // Show onboarding prompt
      showOnboardingPrompt();
    }
  },
});
```

### Conditional feature access

```javascript theme={"system"}
import { isUserOnboardingComplete } from '@dynamic-labs-sdk/client';

const canAccessFeature = isUserOnboardingComplete();

if (!canAccessFeature) {
  console.log('Complete your onboarding to access this feature');
  redirectToOnboarding();
}
```

## What does this check?

The function returns `true` only when **all** of the following conditions are met:

1. **No Missing KYC Fields**: `user.missingFields` is empty or undefined
2. **No Pending MFA Authentication**: User doesn't have the `requiresAdditionalAuth` scope
3. **Recovery Codes Acknowledged**: If MFA is enabled, user has acknowledged their recovery codes

If **any** of these requirements are pending, the function returns `false`.

## React

`isUserOnboardingComplete()` is synchronous — you can call it directly during render. Pair it with `useUser()` so your component re-renders whenever the user state changes (e.g. after the user completes an onboarding step):

```tsx theme={"system"}
import { isUserOnboardingComplete } from '@dynamic-labs-sdk/client';
import { useUser } from '@dynamic-labs-sdk/react-hooks';

function OnboardingGate({ children }: { children: React.ReactNode }) {
  const { data: user } = useUser(); // re-renders on userChanged

  if (!user) return null;
  if (!isUserOnboardingComplete()) return <OnboardingFlow />;

  return <>{children}</>;
}
```

## Related

* [isUserMissingMfaAuth](/javascript/authentication-methods/is-user-missing-mfa-auth) - Check if user needs MFA authentication
* [isPendingRecoveryCodesAcknowledgment](/javascript/authentication-methods/is-pending-recovery-codes-acknowledgment) - Check if recovery codes need acknowledgment
* [refreshUser](/javascript/authentication-methods/refresh-user) - Refresh user data from server
* [Session-Based MFA](/javascript/authentication-methods/mfa/session-mfa) - Configure session-based MFA
* [Recovery Codes](/javascript/authentication-methods/mfa/recovery-codes) - Working with MFA recovery codes
* [User and Session Management](/javascript/user-session-management) - Managing user sessions
