Alaznah

Mint short-lived tokens and connect users securely.

Authentication

Alaznah Calling authenticates each mobile client with a short-lived token minted by your backend.

Never ship API keys or secrets inside the app binary.

Flow

  1. End user signs into your app (email, SSO, etc.)
  2. Your backend validates that session
  3. Your backend mints an Alaznah Calling token using credentials from the Developer Console
  4. The SDK calls getAuthToken() whenever it needs to connect (or reconnect)
  5. Signaling accepts the token and binds the session to config.userId

The userId claimed by the token must match CallingClientConfig.userId.

Client configuration

tsx
<CallingProvider
  config={{
    userId: currentUser.id,
    getAuthToken: async () => {
      const res = await fetch('https://api.yourapp.com/calling/token', {
        headers: { Authorization: `Bearer ${sessionToken}` },
      });
      if (!res.ok) throw new Error('Failed to mint calling token');
      const { token } = await res.json();
      return token;
    },
    // signalingUrl omitted → Hosted Signaling default
  }}
/>

Rules of thumb

  • Return a fresh token on each getAuthToken() call (do not cache forever)
  • Keep TTL short (minutes, not days)
  • On 401 / auth errors from signaling, mint again and reconnect
  • Use a stable, unique userId per end user (the peer dials this id)

Console

  1. Register / sign in at console.alaznah.com
  2. Create a project
  3. Copy App ID / API credentials into your server environment only
  4. Follow the console’s token minting guide for your plan

Exact HTTP shapes for mint endpoints are defined in the console for your account — keep secrets server-side.

Entitlement (commercial)

Separately from end-user JWT auth, the SDK may validate a developer entitlement / feature session via entitlementProvider. Local development falls back to a trial provider when omitted. Production apps should follow the console guidance for paid plans.

Next