JWT authentication, token management, and security best practices for the HAIP SDK
New protocol version released: This page may contain outdated information.
Secure your HAIP applications with robust JWT authentication. Learn how to implement token-based security, manage authentication state, and follow security best practices for production deployments.The HAIP SDK uses JWT (JSON Web Token) Bearer token authentication for secure communication with HAIP servers.
// Server-side: Environment variablesconst token = process.env.HAIP_AUTH_TOKEN;// Browser: Memory only (for sensitive tokens)let tokenInMemory: string | null = null;// Browser: Secure HTTP-only cookies (set by server)// No client-side access needed// Mobile: Secure keychain/keystore// Use platform-specific secure storage
❌ Avoid:
Copy
// Don't store in localStorage (vulnerable to XSS)localStorage.setItem("haip_token", token);// Don't store in sessionStorage (cleared on tab close)sessionStorage.setItem("haip_token", token);// Don't hardcode in source codeconst token = "hardcoded-token-here";