> ## Documentation Index
> Fetch the complete documentation index at: https://dynamic-docs-feat-sidebar-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# onLogout

### 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

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

### Callback Argument Value

```TypeScript
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.

<Note>
  For details about UserProfile, see [here](/react-sdk/objects/userprofile)
</Note>
