Real-time (Ably)
Ably Token
Generate Ably JWT tokens for real-time WebSocket communication
POST
Ably Token Generation
Generate secure Ably JWT tokens for subscribing to real-time events. Supports both QR Login and QR Card Scan session types.Supported Session Types
| Session Type | Channel Format | Use Case |
|---|---|---|
login | qr-login:{session_id} | User authentication via QR code |
card_scan | qr-card:{session_id} | Customer identification at POS |
Endpoint
Authentication
API key from Partners Portal
API secret from Partners Portal
Request Body
The session ID (UUID) from either:
POST /shop/auth/qr-login/generatefor QR LoginPOST /shop/qr-card/generatefor QR Card Scan
Optional. User ID for extended permissions. When provided, grants access to
user-{user_id} channel for shopping sessions.Optional. Shopping session ID for extended permissions. When provided, grants access to
session-{shopping_session_id} channel.Response
Indicates if token was generated successfully
Token Capabilities
The generated token grants the following Ably capabilities:| Channel | Capabilities | Description |
|---|---|---|
| Primary session channel | subscribe, publish, history, presence | QR session events |
user-{user_id} (if provided) | subscribe, publish, history, presence | Shopping session events |
session-{session_id} (if provided) | subscribe, publish, history, presence | Real-time session updates |
session-* | subscribe, publish, history, presence | Create new shopping sessions |
Extended channels (
user-*, session-*) are only included when user_id and/or shopping_session_id are provided in the request.Error Codes
| Code | Description | HTTP Status |
|---|---|---|
AUTH_FORBIDDEN | Invalid or missing API credentials | 403 |
RESOURCE_NOT_FOUND | Session not found or doesn’t belong to partner | 404 |
RESOURCE_EXPIRED | Session has expired | 410 |
INTERNAL_ERROR | Ably not configured or token generation failed | 500 |
Best Practices
Use SDK Method
Use
sdk.createAblyClientOptions() for automatic token renewalUse Response Channel
Always use the
channel from the response rather than constructing it manuallyCheck Session Type
Use
session_type to determine which events to subscribe toError Handling
Handle 410 (expired) errors by generating a new QR session