Conversation
Review Summary by Qodo(Agentic_describe updated until commit a6daf49)Add first-class bearer token credential support with refresh-aware provider
WalkthroughsDescription• Add first-class bearer token credential support alongside basic auth • Implement CredentialsProvider for refresh-aware token sources per RPC • Refactor credential resolution with per-call override precedence • Export type predicates isBasicCredentials and isBearerCredentials • Update OpenTelemetry instrumentation to track auth kind Diagramflowchart LR
A["Per-call credentials"] -->|highest priority| D["Authorization header"]
B["CredentialsProvider"] -->|medium priority| D
C["Default credentials"] -->|lowest priority| D
D -->|gRPC metadata| E["gRPC requests"]
D -->|HTTP header| F["HTTP fallback"]
D -->|bridge| G["Bridge-backed reads"]
File Changes1. packages/db-client/src/types/index.ts
|
Code Review by Qodo
1. Bearer tokens logged in debug
|
510fd17 to
a6daf49
Compare
|
Persistent review updated to latest commit a6daf49 |
Summary
Adds first-class bearer-token authentication to KurrentDB.
You can now pass a bearer token anywhere credentials are accepted:
Or configure a refresh-aware token source that runs once per RPC:
The provider runs ahead of every gRPC, HTTP-fallback, and bridge-backed read (
readAll,readStream), so cached-until-expiry strategies (Azure Entra, OIDC, custom OAuth) just work.When
credentialsProvideris set,appendToStreamfalls back from the cachedbatchAppendstreaming RPC to unaryappendso the provider runs per call.Resolution order
credentialson the requestcredentialsProvider, if setConnection strings remain basic-only. Bearer tokens stay programmatic.
Type changes
BearerCredentialsinterface, plus aCredentialsunion ofBasicCredentials | BearerCredentials.Credentialsinterface (basic-only) is renamed toBasicCredentials.Code that imports
Credentialsand reads.username/.passworddirectly will now need to narrow withisBasicCredentials(c)or switch its annotation toBasicCredentials.Closes DEV-1642