- Docs
- Core Concepts
- Authentication
- Client Alias
Client Alias
An alias is an optional string that identifies a client (for example a user id or device name). It is not a separate authentication method.
How to set it
SDK constructor
const socket = new QPub.Socket({
apiKey: process.env.QPUB_API_KEY,
alias: "user-42",
});
Token claims
await rest.auth.issueToken({ alias: "user-42" });
REST header / Socket query
- REST:
X-Alias: user-42 - WebSocket:
&alias=user-42
Where it appears
- Connection metadata in the platform
- Optional
aliason published messages (you can also setaliasper publish)
await channel.publish({ text: "hi" }, { alias: "user-42", event: "chat" });
Guidance
- Use stable, non-secret identifiers (user id, session id).
- Do not put secrets in the alias.
- Combine with scoped tokens so each client only has the channels it needs.
Previous
Token Auth
Next
Permissions