All documentation
Authentication

tokens.create Function in JavaScript

Create a short-lived client token for frontend or mobile realtime access.

JavaScript

Overview

tokens.create(...) creates a short-lived client token for browser, mobile, desktop, or other non-trusted clients.

Setup

Provide: - identifierId - optional identifierLabel - optional allowedChannels - optional expiresIn - optional metadata

Code example

tokens.create Function in JavaScript
const token = await pulsegrid.tokens.create({
  identifierId: "user_123",
  identifierLabel: "Kwandile",
  allowedChannels: ["demo-channel"],
  expiresIn: 3600,
  metadata: {
    source: "app_backend",
  },
});

console.log(token);

Notes

This should normally be called by your backend after authenticating the real user in your own application.