AuthConfig

data class AuthConfig @ExperimentalAuthApi constructor(val authScheme: AuthScheme, val rawAuthCredential: AuthCredential? = null, val exchangedAuthCredential: AuthCredential? = null, val credentialKey: String = deriveCredentialKey(authScheme, rawAuthCredential))

What a tool needs to authenticate to a service: the scheme the service expects, and the tool's credentials. Creating a config or reading its properties requires @OptIn(ExperimentalAuthApi::class); holding one, as EventActions does, does not.

Throws

Constructors

Link copied to clipboard
constructor(authScheme: AuthScheme, rawAuthCredential: AuthCredential? = null, exchangedAuthCredential: AuthCredential? = null, credentialKey: String = deriveCredentialKey(authScheme, rawAuthCredential))

Types

Link copied to clipboard

Fluent builder for AuthConfig, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

How the service expects the tool to authenticate.

Link copied to clipboard

The key under which ADK stores and looks up exchangedAuthCredential; configs with the same key share it. Defaults to a key derived from authScheme and rawAuthCredential, computed once, so copy keeps it. toString redacts it.

Link copied to clipboard

The credential obtained when the tool has none it can use as is. The app sets it, such as with an API key the user enters; for OAuth2 and OpenID Connect, ADK first sets the authorization URL and state, and the app then adds the sign-in result.

Link copied to clipboard

The credential the tool is configured with: one it uses as is, such as an API key, or one it signs in with, such as an OAuth2 client ID and secret.

Functions

Link copied to clipboard

Returns a Builder initialized with this instance's properties, primarily for Java callers. Prefer it over copy from Java: copy takes every property positionally, so its signature changes whenever a property is added.

Link copied to clipboard
open override fun toString(): String