Overview
HAIP uses JWT Bearer tokens for authentication, providing secure access to the protocol endpoints while supporting session resumption and token refresh.JWT Token Requirements
Required Claims
Your JWT token must include the following claims:Token Presentation
Present your JWT token in one of these ways:WebSocket Query Parameter
WebSocket Query Parameter
WebSocket Protocol
WebSocket Protocol
Token Validation
Server-Side Validation
Servers must validate JWT tokens before establishing HAIP connections:Client-Side Token Management
Implement token refresh and session management:Session Resumption
HAIP supports session resumption using thelast_rx_seq field in the handshake:
Security Best Practices
Token Expiration
Set reasonable expiration times (15-60 minutes) and implement automatic
refresh.
HTTPS Only
Always use TLS 1.2+ (
https:// or wss://) for all HAIP connections.Token Storage
Store tokens securely (memory for short-lived, encrypted storage for refresh
tokens).
Audit Logging
Log authentication events for security monitoring and debugging.
Error Handling
Handle authentication errors gracefully:Example Implementation
Complete Authentication Example
Complete Authentication Example