Handlers is a way to programmatically customize synchronous behaviors in the SDK. They allow running code synchronously and wait until completion, unlike Events that run a-synchronous and do not block the authentication flow.

Handlers are configured in the DynamicContextProvider:

<DynamicContextProvider
  settings={{
    handlers: {
      // handles callbacks go here
    },
  }}
>
  ...
</DynamicContextProvider>

handleConnectedWallet: Handler that runs before Dynamic establishes a wallet connection (Connect wallet before the authentication step). For example This is a good place to run compliance checks.

handleUserOnboarding: Handler that runs whenever the user is still in the process of authentication, but has some missing kyc data to complete before they can be fully authenticated. If information capture is enabled and has required fields or optional fields without the option to skip optional fields during onboarding turned on, the user must be updated with the required information before they’re considered authenticated. This handler is always used when it’s set, which means the sdk will not display the modal to prompt for user information. The handler must be set when using the sdk in a headless mode or if you wish to handle onboarding on your own. For example: When implementing headless sign-in and information capture is enabled, you must have this handler set.

handleVerifiedUser: Handler that runs after the user authenticated but before Dynamic’s finished the authentication flow. For example: It is a good place to perform blocking actions with the user on your backend before Dynamic’s SDK finished the authentication flow.