Skip to main content

Recommended: JavaScript SDK with React Hooks

For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.

Summary

This callback will be called after the user logs out. It will be called either when the user explicitly logged out by calling handleLogOut or when the user’s token expired.

Usage

<DynamicContextProvider
  settings={{
    events: {
      onLogout: (args) => {
        console.log('onLogout was called', args);
      }
    }
  }}
>
 {/* ... rest of your app ... */}
</DynamicContextProvider>

Callback Argument Value

user: UserProfile | undefined;
If your auth mode is connect-only, then the user argument will be undefined, otherwise the user argument will be the user object that just logged out.
For details about UserProfile, see here
Last modified on June 25, 2026