Signature
Parameters
Usage
Basic identification
With attributes
Related
- UserAttributes: the attribute fields this call accepts
- setUserAttributes(): updates attributes without changing identity
- reset(): clears the identity on logout
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Associate your user ID with Encore
fun identify(
userId: String,
attributes: UserAttributes? = null
)
| Name | Type | Description |
|---|---|---|
userId | String | Your user’s unique identifier from your auth system. A blank or whitespace-only value is ignored: it never persists or replaces the current identity, and the SDK logs a warning. |
attributes | UserAttributes? | Optional structured attributes to set for the user in one call. Defaults to null. |
// After successful login
Encore.shared.identify(userId = user.id)
Encore.shared.identify(
userId = user.id,
attributes = UserAttributes(
email = user.email,
subscriptionTier = user.plan,
monthsSubscribed = user.monthsActive.toString()
)
)
identify() after a successful login. On logout, call reset() to clear the user ID and cached entitlements.