Skip to main content
Four host events interact with the SDK. The concepts are shared across both SDKs (read the overview); this page gives the exact React Native code.

1. App launch — every time

Identify unconditionally on launch so users who installed before you added ClarioDesk aren’t left as unlabeled devices. identify() is idempotent and cheap.
import 'react-native-get-random-values';
import { ClarioDesk } from '@clariodesk/react-native';

await ClarioDesk.init({ apiKey: 'pk_live_…' });

const user = await yourAuth.currentUser();
if (user) {
  await ClarioDesk.identify({
    externalId: user.id,
    email: user.email,
    traits: { plan: user.plan },
  });
}

2. Fresh login or signup

await yourAuth.signIn(email, password);
await ClarioDesk.identify({ externalId: user.id, email: user.email });
Overwrites the label on the existing device row — no new device, no new key.

3. Logout

await ClarioDesk.reset();
await yourAuth.signOut();
reset() best-effort revokes the device server-side, wipes the device key, and clears local caches.

4. User switch (A → B without restart)

await ClarioDesk.reset();
await ClarioDesk.init({ apiKey: 'pk_live_…' });
await ClarioDesk.identify({ externalId: userB.id, email: userB.email });
Don’t rebind an existing device to a new user. reset() + new device is the correct boundary — each device row carries an independent ticket history.

Checking state

ClarioDesk.isInitialized(); // boolean
ClarioDesk.isIdentified();  // boolean