Obtaining a Token
Call the token endpoint from your backend server only. Never expose yourclient_secret in browser or mobile code.
Required Scopes & Audience
The WireSocket Data Plane strictly enforces identity verification using the standardaud (Audience) and scope claims. Your JWT must meet these criteria or the connection will be rejected with a 401 Unauthorized error.
1. Audience Enforcement
Theaud claim must be exactly WireSocket.API. This ensures the token was intended for the Data Plane and not for another service.
2. Scope Validation
The token must includeWireSocket.API in either the scope or scp claim. This claim is typically a space-delimited string.
scope nor scp contains WireSocket.API, authentication fails.
3. Client Implementation
When your backend requests a token from the Dashboard using theclient_credentials grant, you must request the WireSocket.API scope explicitly:
JWT Claims
The access token is a signed JWT. Your backend can decode it to inspect the claims — the dataplane reads these directly with no database lookup.Claim Reference
Plan Limits
Thelimits claim contains your plan’s resource caps:
Token Renewal
Access tokens expire after 15 minutes. Use the refresh token to obtain a new access token without re-authenticating with yourclient_secret.
Every refresh issues a new refresh token and invalidates the old one.
Store the latest refresh token after every renewal.
Refresh Token Expiry
Refresh tokens are valid for 7 days. If a refresh token expires, you must re-authenticate using yourclient_id and client_secret to start a new session.
Passing the Token to the Dataplane
When connecting your Yjs provider, pass the access token using one of two methods. Both are supported in all regions.- WebSocket Subprotocol (Recommended)
- URL Parameter
Allowed Domains
Each app supports up to 3 allowed domains. This is a critical security feature designed to prevent Token Theft in browser-based applications.How it works
- Origin Enforcement: When a client connects to a node, the Data Plane checks the browser’s
Originheader. - JWT Validation: The node compares this
Originagainst theallowed_domainclaims baked into your JWT. - Automatic Rejection: If the domain does not match (e.g., a token stolen and used on
evil.com), the connection is immediately rejected.
Configuration Rules
- Normalization: The Dashboard automatically strips protocols (
https://) and trailing slashes. Enteringhttps://myapp.com/results inmyapp.com. - Development Support: You can add
localhostorlocalhost:portto your slots during development. - Strict Format: Domains are validated against standard regex patterns before saving.
Plan Cancellation & Revocation
If a plan is cancelled or an app is deleted, existing connections are not immediately terminated. Active sessions continue until the current access token expires. No new tokens can be issued after cancellation.This means tenants have up to 15 minutes of continued access after a plan
change takes effect. Plan accordingly if you need immediate revocation.
{tenantId} with your tenant GUID, available in the tenantid claim of your JWT. For a deep-dive into how we secure these keys, see our Security & Hardening guide.
Key Rotation & Multiple Keys
WireSocket periodically rotates your tenant’s signing key. During rotation, the endpoint returns multiple public keys to facilitate a seamless transition:
If you are caching the JWKS response locally, re-fetch it when signature validation fails to pick up a newly rotated key.
This endpoint is rate limited to 20 requests per 10 minutes. Local caching
is strongly recommended.

