AccessTokenProvider

org.llm4s.llmconnect.auth.AccessTokenProvider
@Stable

Supplies the bearer token for each request, refreshing it as needed.

Stable since #1818: OpenAICompatibleClient.Credential.Dynamic takes one. An implementation should return a failure as a Left rather than throw; a client that calls it turns a thrown exception into an AuthenticationError all the same.

Attributes

Source
AccessTokenProvider.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def invalidate(rejected: String): Unit

Reports that the server rejected rejected. The cached token is dropped only if it is that token, so concurrent calls that all saw a 401 for the same token cause one refresh, and a late report about an older token does not discard a newer one.

Reports that the server rejected rejected. The cached token is dropped only if it is that token, so concurrent calls that all saw a 401 for the same token cause one refresh, and a late report about an older token does not discard a newer one.

Attributes

Source
AccessTokenProvider.scala
def token(): Result[String]

A token believed valid now.

A token believed valid now.

Attributes

Source
AccessTokenProvider.scala