Skip to main content

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

PropertyTypeDescription
userIdstring | nullLumio user ID of the current viewer, or null for unauthenticated interactive visitors
accountIdstringLumio account ID that owns this overlay installation
role"owner" | "editor" | "viewer" | "anonymous"Role of the current user in this account
platformstring | nullViewer's connected platform (e.g. "twitch"), or null
platformUserIdstring | nullViewer's platform user ID, or null
platformUserNamestring | nullViewer'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

SurfaceuserIdroleplatform*
EditorLogged-in Lumio userAccount roleConnected platform if any
Layernull (no viewer identity in OBS)"viewer"null
InteractiveViewer's Lumio user ID if authenticated"viewer" or "anonymous"Platform if connected

Notes

  • On the interactive surface, userId is null for unauthenticated visitors (token-only access without Lumio account login)
  • Use role for access control in the editor — do not rely on userId alone
  • accountId is always set — it identifies the account that installed the extension