useLumioIdentity
Access the current user and account context — who is viewing this surface, what account they belong to, and what role they hold.
Signature
const identity = useLumioIdentity();
Parameters
This hook takes no parameters.
Return value
| Property | Type | Description |
|---|---|---|
userId | string | null | Lumio user ID of the current viewer, or null for unauthenticated interactive visitors |
accountId | string | Lumio account ID that owns this overlay installation |
role | "owner" | "editor" | "viewer" | "anonymous" | Role of the current user in this account |
platform | string | null | Viewer's connected platform (e.g. "twitch"), or null |
platformUserId | string | null | Viewer's platform user ID, or null |
platformUserName | string | null | Viewer's platform username, or null |
Example: Show different UI by role
import { useLumioIdentity, CompactView, Text, Button } from "@zaflun/lumio-sdk";
function ConditionalEditor() {
const identity = useLumioIdentity();
if (identity.role === "owner" || identity.role === "editor") {
return (
<CompactView title="Admin controls">
<Button label="Reset scores" onClick={() => {/* ... */}} />
</CompactView>
);
}
return (
<CompactView title="View only">
<Text content="You don't have permission to edit this." variant="muted" />
</CompactView>
);
}
Example: Personalized interactive page
import { useLumioIdentity, Text } from "@zaflun/lumio-sdk";
function PersonalizedGreeting() {
const identity = useLumioIdentity();
const name = identity.platformUserName ?? "viewer";
return <Text content={`Welcome, ${name}!`} variant="heading" />;
}
Identity on different surfaces
| Surface | userId | role | platform* |
|---|---|---|---|
| Editor | Logged-in Lumio user | Account role | Connected platform if any |
| Layer | null (no viewer identity in OBS) | "viewer" | null |
| Interactive | Viewer's Lumio user ID if authenticated | "viewer" or "anonymous" | Platform if connected |
Notes
- On the interactive surface,
userIdisnullfor unauthenticated visitors (token-only access without Lumio account login) - Use
rolefor access control in the editor — do not rely onuserIdalone accountIdis always set — it identifies the account that installed the extension