The onReauthRequested callback is triggered when the authentication token expires or becomes invalid. Your implementation should:
Fetch a new token from your server
Return the new token to update the SDK
Copy
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 }};
The SDK will use the returned token to automatically update its authentication
state. You do not need to manually dispose and reinitialize the SDK.