Skip to main content
Unsupported HAIP 1 archive. This is historical chat and streaming documentation, not the HAIP 2 review protocol. Its APIs, package examples and security advice must not be used for a HAIP 2 deployment. Start with the current HAIP 2 guides.

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:

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 the last_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