The four host events that touch the SDK: wire each one and you’re done.
Four moments in your app’s lifecycle interact with the SDK. Wire all four and
the integration is complete. The code below is platform-agnostic; see the
per-SDK lifecycle guides for exact syntax
(Flutter, React Native,
Swift).
1. App launch (every time)
The most common integration miss: users who installed your app before you added
ClarioDesk never go through login again, so an “identify on login” hook alone
leaves them as unlabeled devices.Hydrate from your own persisted session on launch and identify
unconditionally. identify() is idempotent (same values = no-op write) and
cheap (one signed POST, roughly 5 to 25 ms).
The stable user id your auth system already gives you — the same value its
tokens carry in sub, which is what lets a later upgrade to
Verified identity prove the id you were already
sending:
Your auth
Pass as externalId
Firebase Auth
user.uid
Clerk
user.id
Supabase
user.id
Auth0
user.sub
Sign in with Apple
credential.user
Google Sign-In
account.id
Your own backend
the user row’s primary key
Never pass an auth token as externalId — tokens rotate, so every refresh
would look like a different person. Never use an email as the id either
(emails change and can be re-registered by someone else; pass it in email:
instead), and avoid guessable ids like sequential integers.
2. Fresh login or signup
Right after your auth succeeds, call identify(). This overwrites the label on
the existing device row, without registering a new device or generating a new
key. The same device now carries the new user’s metadata.
3. Logout
With Verified identity, call
clearIdentity() before signing the user out of your own app.
clearIdentity() preserves the device key, advances the signed identity epoch,
and prevents old-account cache/network work from becoming visible to the next
host user. In label-only mode, reset() remains the stronger shared-device
isolation option.
4. User switch (A → B without restart)
Create and await the clearIdentity() intent, switch the host session, then
verified-identify user B with a fresh proof.
Never activate user B before the clear intent exists, and never fall back to a
label write after proof failure. reset() removes this installation; customer
erasure is a separate owner/admin dashboard action.
What if I never call identify()?
Tickets still work. The device row exists and agents see a device id but no
email, and the dashboard shows an “Unverified device” badge. Useful for
anonymous-feedback flows; otherwise, wire case 1 above.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"ClarioDesk","description":"In-app support and bug reporting SDKs for Flutter, React Native, and native iOS (Swift).","colors":{"primary":"#809447","light":"#D4FF00","dark":"#5F6E36"},"logo":{"light":"https://mintcdn.com/clariodesk/nlEbZ2118mD971gH/logo/light.svg?fit=max\u0026auto=format\u0026n=nlEbZ2118mD971gH\u0026q=85\u0026s=05cf11cb6d111dd635cd7be420d87076","dark":"https://mintcdn.com/clariodesk/nlEbZ2118mD971gH/logo/dark.svg?fit=max\u0026auto=format\u0026n=nlEbZ2118mD971gH\u0026q=85\u0026s=b26fd941f305e7a38ecc72386de165ad"},"favicon":"https://mintcdn.com/clariodesk/nlEbZ2118mD971gH/favicon.svg?fit=max\u0026auto=format\u0026n=nlEbZ2118mD971gH\u0026q=85\u0026s=a741288538376c49b031a0c2ea29d72a","appearance":{"default":"dark"},"navbar":{"links":[{"href":"https://dashboard.clariodesk.com","label":"Dashboard"}],"primary":{"type":"button","label":"Get started","href":"https://clariodesk.com"}},"footer":{"socials":{"github":"https://github.com/clariodesk","website":"https://clariodesk.com"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode","mcp"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"clariodesk","hasAudioNarration":false,"actualSubdomain":"clariodesk","customDomains":["docs.clariodesk.com"],"gitSource":{"type":"github","owner":"shipwithdhruvil","repo":"clariodesk-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a94f06349c45aa1a0eb5673","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"default","tag":"Get started","count":15},{"language":"default","tag":"Core concepts","count":8},{"language":"default","tag":"React Native SDK","count":6},{"language":"default","tag":"React Native","count":6},{"language":"default","tag":"Swift SDK","count":6},{"language":"default","tag":"Swift","count":6},{"language":"default","tag":"Flutter SDK","count":5},{"language":"default","tag":"Flutter","count":5},{"language":"default","tag":"Integration","count":3},{"language":"default","tag":"Build with AI","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"concepts/identity-lifecycle","slug":"/concepts/identity-lifecycle","pageMetadata":{"title":"Identity \u0026 lifecycle","description":"The four host events that touch the SDK: wire each one and you're done.","href":"/concepts/identity-lifecycle"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"The four host events that touch the SDK: wire each one and you’re done.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Four moments in your app’s lifecycle interact with the SDK. Wire all four and\nthe integration is complete. The code below is platform-agnostic; see the\nper-SDK lifecycle guides for exact syntax\n(`,_jsx(_components.a,{href:`/flutter/lifecycle`,children:`Flutter`}),`, `,_jsx(_components.a,{href:`/react-native/lifecycle`,children:`React Native`}),`,\n`,_jsx(_components.a,{href:`/swift/lifecycle`,children:`Swift`}),`).`]}),`\n`,_jsx(Heading,{level:`2`,id:`1-app-launch-every-time`,children:`1. App launch (every time)`}),`\n`,_jsx(_components.p,{children:`The most common integration miss: users who installed your app before you added\nClarioDesk never go through login again, so an “identify on login” hook alone\nleaves them as unlabeled devices.`}),`\n`,_jsxs(_components.p,{children:[`Hydrate from your own persisted session on launch and identify\n`,_jsx(_components.strong,{children:`unconditionally`}),`. `,_jsx(_components.code,{children:`identify()`}),` is idempotent (same values = no-op write) and\ncheap (one signed POST, roughly 5 to 25 ms).`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Flutter`,numberOfLines:`5`,language:`dart`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`dart`,children:_jsxs(_components.code,{language:`dart`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(apiKey`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'pk_live_…'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`final`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yourAuth.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`currentUser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (user `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(externalId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user.id, email`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` user.email);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`React Native`,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`apiKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'pk_live_…'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` user`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` yourAuth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`currentUser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`externalId:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`email:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` user`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`email`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})]}),`\n`]})})})]}),`\n`,_jsxs(Heading,{level:`3`,id:`which-value-is-externalid`,children:[`Which value is `,_jsx(_components.code,{children:`externalId`}),`?`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.strong,{children:`stable user id`}),` your auth system already gives you — the same value its\ntokens carry in `,_jsx(_components.code,{children:`sub`}),`, which is what lets a later upgrade to\n`,_jsx(_components.a,{href:`/concepts/verified-identity`,children:`Verified identity`}),` prove the id you were already\nsending:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Your auth`}),_jsxs(_components.th,{children:[`Pass as `,_jsx(_components.code,{children:`externalId`})]})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Firebase Auth`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`user.uid`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Clerk`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`user.id`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Supabase`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`user.id`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Auth0`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`user.sub`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Sign in with Apple`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`credential.user`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Google Sign-In`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`account.id`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Your own backend`}),_jsx(_components.td,{children:`the user row’s primary key`})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never pass an auth `,_jsx(_components.strong,{children:`token`}),` as `,_jsx(_components.code,{children:`externalId`}),` — tokens rotate, so every refresh\nwould look like a different person. Never use an `,_jsx(_components.strong,{children:`email`}),` as the id either\n(emails change and can be re-registered by someone else; pass it in `,_jsx(_components.code,{children:`email:`}),`\ninstead), and avoid guessable ids like sequential integers.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`2-fresh-login-or-signup`,children:`2. Fresh login or signup`}),`\n`,_jsxs(_components.p,{children:[`Right after your auth succeeds, call `,_jsx(_components.code,{children:`identify()`}),`. This overwrites the label on\nthe existing device row, without registering a new device or generating a new\nkey. The same device now carries the new user’s metadata.`]}),`\n`,_jsx(Heading,{level:`2`,id:`3-logout`,children:`3. Logout`}),`\n`,_jsxs(_components.p,{children:[`With `,_jsx(_components.a,{href:`/concepts/verified-identity`,children:`Verified identity`}),`, call\n`,_jsx(_components.code,{children:`clearIdentity()`}),` before signing the user out of your own app.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Flutter`,numberOfLines:`2`,language:`dart`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`dart`,children:_jsxs(_components.code,{language:`dart`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`clearIdentity`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` yourAuth.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signOut`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`React Native`,numberOfLines:`2`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` ClarioDesk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`clearIdentity`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` yourAuth`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`signOut`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`clearIdentity()`}),` preserves the device key, advances the signed identity epoch,\nand prevents old-account cache/network work from becoming visible to the next\nhost user. In label-only mode, `,_jsx(_components.code,{children:`reset()`}),` remains the stronger shared-device\nisolation option.`]}),`\n`,_jsx(Heading,{level:`2`,id:`4-user-switch-a-→-b-without-restart`,children:`4. User switch (A → B without restart)`}),`\n`,_jsxs(_components.p,{children:[`Create and await the `,_jsx(_components.code,{children:`clearIdentity()`}),` intent, switch the host session, then\nverified-identify user B with a fresh proof.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never activate user B before the clear intent exists, and never fall back to a\nlabel write after proof failure. `,_jsx(_components.code,{children:`reset()`}),` removes this installation; customer\nerasure is a separate owner/admin dashboard action.`]})}),`\n`,_jsxs(Heading,{level:`2`,id:`what-if-i-never-call-identify-`,children:[`What if I never call `,_jsx(_components.code,{children:`identify()`}),`?`]}),`\n`,_jsx(_components.p,{children:`Tickets still work. The device row exists and agents see a device id but no\nemail, and the dashboard shows an “Unverified device” badge. Useful for\nanonymous-feedback flows; otherwise, wire case 1 above.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Identity \u0026 lifecycle","description":"The four host events that touch the SDK: wire each one and you're done.","href":"/concepts/identity-lifecycle"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"1. App launch (every time)","slug":"1-app-launch-every-time","depth":2,"children":[{"title":"Which value is externalId?","slug":"which-value-is-externalid","depth":3,"children":[]}]},{"title":"2. Fresh login or signup","slug":"2-fresh-login-or-signup","depth":2,"children":[]},{"title":"3. Logout","slug":"3-logout","depth":2,"children":[]},{"title":"4. User switch (A → B without restart)","slug":"4-user-switch-a-→-b-without-restart","depth":2,"children":[]},{"title":"What if I never call identify()?","slug":"what-if-i-never-call-identify-","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"clariodesk","siteName":"ClarioDesk","title":"Identity \u0026 lifecycle - ClarioDesk","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-23T03:47:08.114Z","originalFileLocation":"concepts/identity-lifecycle.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"The four host events that touch the SDK: wire each one and you\u0026#x27;re done.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ClarioDesk\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Identity \u0026amp; lifecycle - ClarioDesk\">\u003cmeta data-mint-head property=\"og:description\" content=\"The four host events that touch the SDK: wire each one and you\u0026#x27;re done.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ClarioDesk\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.clariodesk.com/concepts/identity-lifecycle\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://clariodesk.mintlify.site/_mintlify/api/og/v2?division=Core+concepts\u0026amp;title=Identity+%26+lifecycle\u0026amp;description=The+four+host+events+that+touch+the+SDK%3A+wire+each+one+and+you%27re+done.\u0026amp;theme=03d21b49a97fe3c828410fd2\u0026amp;signature=b1ef36fcfcefd44992f7e92a41a3106323ffb6bcb9fef520ff8f8332f45b6855\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Identity \u0026amp; lifecycle - ClarioDesk\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The four host events that touch the SDK: wire each one and you\u0026#x27;re done.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://clariodesk.mintlify.site/_mintlify/api/og/v2?division=Core+concepts\u0026amp;title=Identity+%26+lifecycle\u0026amp;description=The+four+host+events+that+touch+the+SDK%3A+wire+each+one+and+you%27re+done.\u0026amp;theme=03d21b49a97fe3c828410fd2\u0026amp;signature=b1ef36fcfcefd44992f7e92a41a3106323ffb6bcb9fef520ff8f8332f45b6855\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/clariodesk/nVuqOLJh4xCQWkxU/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ClarioDesk\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#809447\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.clariodesk.com/concepts/identity-lifecycle\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/concepts/identity-lifecycle.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.clariodesk.com/#organization\",\"name\":\"ClarioDesk\",\"url\":\"https://docs.clariodesk.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/clariodesk/nlEbZ2118mD971gH/logo/light.svg?fit=max\u0026auto=format\u0026n=nlEbZ2118mD971gH\u0026q=85\u0026s=05cf11cb6d111dd635cd7be420d87076\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.clariodesk.com#website\",\"name\":\"ClarioDesk\",\"url\":\"https://docs.clariodesk.com\",\"publisher\":{\"@id\":\"https://docs.clariodesk.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.clariodesk.com/concepts/identity-lifecycle#webpage\",\"url\":\"https://docs.clariodesk.com/concepts/identity-lifecycle\",\"name\":\"Identity \u0026 lifecycle\",\"description\":\"The four host events that touch the SDK: wire each one and you're done.\",\"dateModified\":\"2026-08-23T03:47:08.114Z\",\"isPartOf\":{\"@id\":\"https://docs.clariodesk.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.clariodesk.com/concepts/identity-lifecycle#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.clariodesk.com/concepts/identity-lifecycle#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Core concepts\",\"item\":\"https://docs.clariodesk.com/concepts/architecture\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Identity \u0026 lifecycle\",\"item\":\"https://docs.clariodesk.com/concepts/identity-lifecycle\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.clariodesk.com/concepts/identity-lifecycle#article\",\"headline\":\"Identity \u0026 lifecycle\",\"name\":\"Identity \u0026 lifecycle\",\"description\":\"The four host events that touch the SDK: wire each one and you're done.\",\"url\":\"https://docs.clariodesk.com/concepts/identity-lifecycle\",\"mainEntityOfPage\":{\"@id\":\"https://docs.clariodesk.com/concepts/identity-lifecycle#webpage\"},\"dateModified\":\"2026-08-23T03:47:08.114Z\",\"publisher\":{\"@id\":\"https://docs.clariodesk.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.clariodesk.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"ClarioDesk\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"ClarioDesk\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/concepts/identity-lifecycle.md","siteName":"ClarioDesk","nav":{"global":null,"tabs":[{"tab":"Get started","groups":[{"group":"Introduction","pages":[{"title":"ClarioDesk SDKs","href":""},{"title":"Quickstart","href":"/quickstart"}]},{"group":"Integration","pages":[{"title":"Integrating into your Flutter app","href":"/integrate-flutter"},{"title":"Integrating into your React Native app","href":"/integrate-react-native"},{"title":"Integrating into your Swift app","href":"/integrate-swift"}]},{"group":"Build with AI","pages":[{"title":"Install with AI","href":"/claude-code"},{"title":"Rules for AI agents","href":"/concepts/agent-rules"}]},{"group":"Core concepts","pages":[{"title":"Architecture","href":"/concepts/architecture"},{"title":"Authentication","href":"/concepts/authentication"},{"title":"Verified identity","description":"Secure cross-device customer continuity with host tokens or a pinned OIDC provider.","href":"/concepts/verified-identity"},{"title":"Identity \u0026 lifecycle","href":"/concepts/identity-lifecycle"},{"title":"Realtime","description":"Agent replies, status changes, presence, and read receipts stream to the device live.","href":"/concepts/realtime"},{"title":"Attachments","href":"/concepts/attachments"},{"title":"Push notifications","href":"/concepts/push-notifications"},{"title":"CSAT","href":"/concepts/csat"}]}]},{"tab":"Flutter SDK","pages":[{"title":"Flutter SDK","href":"/flutter/quickstart"}]},{"tab":"React Native SDK","pages":[{"title":"React Native SDK","href":"/react-native/quickstart"}]},{"tab":"Swift SDK","pages":[{"title":"Swift SDK","href":"/swift/quickstart"}]}]},"basePath":"","title":"Identity \u0026 lifecycle - ClarioDesk","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":[],"chunks":[]}