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

# Implementing Callbacks

> Handle SDK events correctly

The Reach SDK requires callback handlers to manage authentication and tenant events.

## Required Callbacks

### onReauthRequested Callback

The `onReauthRequested` callback is triggered when the authentication token expires or becomes invalid. Your implementation should:

1. Fetch a new token from your server
2. Return the new token to update the SDK

```javascript theme={null}
const handleReauth = async () => {
  try {
    // Fetch a new auth token from your server
    const response = await fetch('/reach-authtoken');
    const data = await response.json();

    if (!data.success) {
      throw new Error('Failed to get new token');
    }

    // Return the new token
    return data.token;
  } catch (error) {
    console.error('Authentication failed:', error);
    // Handle error appropriately in your UI
  }
};
```

<Note>
  The SDK will use the returned token to automatically update its authentication
  state. You do not need to manually dispose and reinitialize the SDK.
</Note>
