Documentation
Current user
setUser stores a user id on the client; later errors include it.
Product overview (Users column, privacy): Features → Current user.
setUser
import { setUser } from '@retrace-kit/sdk';
setUser({ id: 'usr_8f3k2' }); id is required — non-empty string. Use a stable id from your system, not a session token.
Can run before init. Stays until you change it.
When to call
- after login
- on app boot if a session is already present
- after profile load once you have a stable id
async function onLogin(session) {
setUser({ id: session.userId });
}
// on logout
setUser({ id: 'anonymous' });