TokenCredentialManager

Java-friendly token credential manager for JVM applications.

Provides blocking CRUD operations for credentials, wrapping the cross-platform KmpCredentialManager with AuthFoundationResult for Java interop.

Warning: All public methods use runBlocking internally. Do not call them from a coroutine or a thread that is part of a coroutine dispatcher — this will deadlock. For coroutine-based callers, use KmpCredentialManager directly.

Event listeners can be registered via addEventListener to receive credential lifecycle events.

Parameters

client

The OAuth2Client used for token operations.

storage

The TokenStorage for persisting tokens.

defaultIdStore

Store for the default credential ID.

Constructors

Link copied to clipboard
constructor(client: OAuth2Client, storage: TokenStorage, defaultIdStore: DefaultCredentialIdStore)

Functions

Link copied to clipboard

Registers a listener that is notified whenever a credential lifecycle event occurs.

Link copied to clipboard

Returns all stored credential IDs.

Link copied to clipboard
open override fun close()

Closes this manager, cancelling event dispatch.

Link copied to clipboard
fun createTokenData(accessToken: String, tokenType: String = "Bearer", expiresIn: Int = 3600, scope: String? = null, refreshToken: String? = null, idToken: String? = null, deviceSecret: String? = null): TokenData

Creates a TokenData from raw token fields. Convenience method for Java callers.

Link copied to clipboard

Deletes a credential by ID.

Link copied to clipboard

Retrieves a credential by its ID.

Link copied to clipboard

Returns the default credential, or null if no default has been set.

Link copied to clipboard

Returns metadata for the credential with the specified ID.

Link copied to clipboard

Sets the default credential.

Link copied to clipboard

Stores a new credential with the given token data and optional tags.