Overview
The SDK supports two layers of identity:
The SDK works anonymously out of the box. Call
identify() to associate conversations with a specific user.
Device ID
Every SDK instance has a stable device ID, generated automatically on creation:The device ID uses Android’s
Settings.Secure.ANDROID_ID when available. On emulators or when restricted, it falls back to a UUID persisted in SharedPreferences (chatbase_sdk_prefs). The ID remains stable across app launches.identify
interface ChatbaseClient — Package: com.chatbase.sdk
identify() is equivalent to verify() — it verifies the token server-side and triggers the anonymous-conversation merge.
String
required
A JWT generated by your backend and signed with your agent’s identity verification secret. The payload must include a
user_id (or sub) claim.1
Generate a JWT on your backend
Create a signed JWT token on your server containing the user ID in its payload.
2
Pass the token to the SDK
3
Check identity status
Identity Properties
true if a JWT token has been set via identify().
null if not identified.
verify
identify() is an alias for this method.
String
required
The JWT token to verify.
When
verify() succeeds, the server automatically merges previously anonymous (device-scoped) conversations into the verified user’s account. Conversations started before identification are preserved and accessible under the user’s identity.The merge runs asynchronously on the server — a listConversations() call issued immediately after verify() returns may not reflect it yet.How Identity Affects Conversations
When identified, conversations are scoped to the user —
listConversations() returns only that user’s conversations. Without identity, conversations are scoped to the device.logout
identify() and verify() are equivalent — both verify the token with the server and trigger the merge of prior anonymous (device-scoped) conversations into the user’s account. You never need to call both.Related
Conversations & History
List conversations and load message history
Overview
SDK setup and configuration
