User object
When a user is signed in, tiun exposes them to your app as a user object. It's the canonical "who is this person and what can they use" record on the client.
Reading the user
Call tiun.getUser() to read the current state. It returns an object shaped like:
{ isAuthenticated, user }When someone is signed in, user is the user object. When they're not, user is null and isAuthenticated is false.
The same payload is also available on every userChange event, so you rarely call getUser() directly — listening to userChange keeps your UI in sync. For one-off reads, the quick-access properties tiun.user and tiun.isAuthenticated are also available. See SDK properties.
Shape
userId
string
Stable identifier for this user in tiun.
email
string
Email on the account; used for receipts and identification.
productAccess
string[]
Product IDs the user is entitled to — active subscriptions and completed one-time purchases. See Product access.
Typical payloads
Unauthenticated:
{ isAuthenticated: false, user: null }Authenticated, no purchases:
Authenticated with purchases:
When the user object updates
The user object is populated and refreshed at several points:
After a successful checkout (
event: 'checkout')After a successful login (
event: 'login')After session restore on page load (
event: 'init')After logout, where
userbecomesnull(event: 'logout')When entitlements change — for example a subscription expires, removing its product ID from
productAccess. One-time purchases don't expire, so their IDs stay put.
Listen to userChange so your UI reflects each of these moments. For UI gating patterns built on top of this state, see Protecting content.
Last updated
Was this helpful?

