auth library

Classes

AuthConfig
Tuning knobs for authInterceptor.
FunctionTokenSource
Adapts a function into a TokenSource. The function is invoked once per request that needs a token. Callers responsible for caching and refresh implement that logic inside the closure.
StaticTokenSource
Returns the same token for every call. Use for API keys, manually-issued long-lived JWTs, and tests.
TokenSource
Source of credentials for the auth interceptor. Called once per request that does not already carry an Authorization header.

Constants

authorizationHeader → const String
Conventional header for Bearer / API-key credentials.
bearerPrefix → const String
Conventional Bearer prefix per RFC 6750.

Functions

authInterceptor(AuthConfig config) → Interceptor
Builds an Interceptor that fetches a credential from AuthConfig.source and writes it into AuthConfig.headerName before delegating to next.