For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReferenceClick-to-Call
GuidesReferenceClick-to-Call
  • Getting Started
    • Overview
    • Authentication
    • RxJS Primer
    • Migrate from v3
  • Web Components
    • Overview
    • Click-to-Call
    • Theming
    • Customization
  • Build Voice & Video Apps
    • Overview
    • Outbound Calls
    • Inbound Calls
    • Device Management
    • Screen Sharing
    • Call Controls
    • Layouts
    • Messaging & Chat
  • Manage Resources
    • Overview
    • Users
    • Address Book
    • Client Preferences
    • Capabilities
  • Deploy
    • Overview
    • Framework Integration
    • SSR & Next.js
    • Troubleshooting
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Accessing the authenticated user
  • Profile
  • Assigned addresses
  • Scopes
  • Creating and managing Users
  • Sign-out
  • Reference
Manage Resources

Users

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

Address Book & Directory

Next
Built with

Users are the Browser SDK’s name for what the platform calls Subscribers — the SignalWire Resource type that represents a person in your application. Each User has credentials, a profile, a private Address for direct dialing, and may own public phone numbers. When the Browser SDK authenticates with a Subscriber Access Token (SAT), the platform identifies the caller as one specific User, and the SDK surfaces that identity through client.user.

Not every SAT corresponds to a registered User (subscriber) — guest and invite tokens produce temporary sessions that don’t map to a platform-side Subscriber Resource. The SDK exposes all of them through the same User object on client.user, which carries whatever identity and scopes the token was minted with.

This guide covers the runtime side: reading the authenticated profile, gating on scopes, and ending the session. For creating Users (Subscriber Resources) on the server, see the platform docs and the REST API.

Accessing the authenticated user

client.user is populated automatically when the client connects. Subscribe to client.user$ to wait for it without risking a null read:

1import { SignalWire, StaticCredentialProvider } from "@signalwire/js";
2
3const client = new SignalWire(
4 new StaticCredentialProvider({ token: "YOUR_SAT" })
5);
6
7client.user$.subscribe((user) => {
8 if (!user) return;
9 console.log("Signed in as", user.displayName ?? user.email);
10});

client.user$ is a BehaviorSubject — late subscribers receive the cached value synchronously once the profile loads.

Profile

The User instance carries the platform-side profile: identity (id, email, firstName / lastName / displayName), organization context (jobTitle, companyName, timeZone, country, region), the assigned addresses and pushNotificationKey, plus appSettings.scopes from the SAT. See User for the full field list.

1client.user$.subscribe((user) => {
2 if (!user) return;
3 document.querySelector("#name").textContent =
4 user.displayName ?? `${user.firstName ?? ""} ${user.lastName ?? ""}`.trim();
5 document.querySelector("#email").textContent = user.email;
6 document.querySelector("#company").textContent = user.companyName ?? "";
7});

Assigned addresses

user.addresses is the list of Resource Addresses the authenticated identity owns directly — typically one private address (e.g. /private/jane-doe) plus any phone numbers or aliases the platform has provisioned. These are the addresses others dial to reach this user.

This is distinct from client.directory, which is the broader list of addresses this user can reach (other Users, rooms, AI agents, scripts the platform exposes). See Address Book & Directory.

Scopes

user.appSettings?.scopes reflects the permission scopes the SAT was minted with. Use it to gate UI for features the backend has opted the user into:

1client.user$.subscribe((user) => {
2 if (!user) return;
3 const canRecord = user.appSettings?.scopes.includes("recording");
4 recordButton.hidden = !canRecord;
5});

Scopes are advisory in the UI — enforcement is server-side. Reading them locally avoids showing buttons that would fail.

Creating and managing Users

User lifecycle happens on your backend — the Browser SDK can only sign in as an existing identity. Use the Subscribers REST API from your server (with your SignalWire API credentials, never from the browser). The typical flow: on login, your backend looks up or creates a User (Subscriber) for the authenticated user, mints a SAT, and returns it to the browser. See Authentication for the token flow.

Sign-out

The User’s platform record persists as a Subscriber Resource; “sign out” means ending the session. Disconnect the client and discard the SAT:

1await client.disconnect();

A disconnected client can be garbage-collected. For the next login, construct a new SignalWire with a fresh credential provider.

Reference

  • client.user / client.user$ — authenticated user accessor and observable
  • User — profile fields (id, email, firstName, lastName, displayName, addresses, pushNotificationKey, appSettings, satClaims)
  • client.directory — addresses this user can reach
  • client.disconnect() — end the session