Authentication
KalamDB supports user/password bootstrap and JWT bearer tokens. For long-lived services, prefer JWT with refresh or a dynamic auth provider.
Auth types
Pass credentials to the builder:
Basic auth bootstrap
AuthProvider::basic_auth(user, password) does not send HTTP Basic on every request. The client exchanges credentials on POST /v1/api/auth/login and then uses the returned JWT for SQL, files, topics, and WebSocket traffic.
You never call apply_to_request with basic credentials directly — that method returns an error for BasicAuth by design.
JWT auth
When you already have a token:
Or use the builder shortcut:
Explicit login and refresh
login and refresh_access_token require the auth-flows feature (included in default native-sdk).
Refresh:
Update auth on an existing client
For dynamic providers, see Auth-Aware Client.
TOKEN_EXPIRED recovery
Pass an auth_refresher callback when building the client to recover from expired tokens on query or subscription paths:
System user convenience
AuthProvider::system_user_auth(password) is shorthand for basic auth as user root. Common in examples and internal tools: