WuKongIM Docs

Authentication & Security

Understand trust boundaries among browsers, product backends, Product HTTP, and Gateway.

Product HTTP is for trusted backends. Browsers connect to Gateway through the SDK or request server capabilities through a same-origin BFF.

Trust boundaries

browser -> same-origin BFF -> Product HTTP
browser + SDK -> Gateway

The browser should receive only the UID, temporary token, and WebSocket address needed for its current connection. It must not receive the Product HTTP address or a server credential.

Storing a token is not CONNECT authentication

POST /user/token only stores device-token metadata. The default Gateway does not automatically validate a later CONNECT against that record; production must add explicit token validation and rejection policy.

Production requirements

CapabilityOwner
Account, tenant, UID, and device policyProduct identity service and backend
Token generation, expiry, revocation, and secure storageProduct backend
CONNECT token validationGateway
Product HTTP authentication, authorization, limits, and auditAPI Gateway, service mesh, or product backend
TLS, key rotation, and alertsProduction platform

Protocol encryption does not replace TLS, account authentication, or HTTP service authorization. Tokens must not appear in URLs, logs, or screenshots.

The sample BFF is for local development only

Bind the sample BFF to loopback and validate Host/Origin. Do not deploy it to the public internet, shared test environments, or real-user traffic.

Related references: /user/token, Error Responses, and Integration Architecture.

On this page