public interface TokenStore

Known subtypesTokenStore.DefaultStorageTokenStore

Pluggable persistence for an OidcClient’s tokens. Implement this and pass to OidcClient.setTokenStore(TokenStore) when you want a custom strategy (e.g. cross-device sync, encrypted-at-rest with your own key, in-memory only). The default is DefaultStorageTokenStore, which serialises tokens to the standard Storage under a per-issuer key. For biometric-gated persistence on iOS / Android, use SecureStorageTokenStore.

All methods are asynchronous and may run network or biometric prompts on the calling thread.

Nested types

class TokenStore.DefaultStorageTokenStoreThe default store.

Methods

public abstract AsyncResource<OidcTokens> load(String key)Reads previously-saved tokens for key, or completes with null if nothing is stored.
public abstract AsyncResource<Boolean> save(String key, OidcTokens tokens)Persists tokens under key.
public abstract AsyncResource<Boolean> clear(String key)Removes the entry for key.

Method details

load

public abstract AsyncResource<OidcTokens> load(String key)
Reads previously-saved tokens for key, or completes with null if nothing is stored.

save

public abstract AsyncResource<Boolean> save(String key, OidcTokens tokens)
Persists tokens under key. Implementations should overwrite any existing entry atomically.

clear

public abstract AsyncResource<Boolean> clear(String key)
Removes the entry for key. Completing with Boolean.FALSE means nothing was stored; completing with an error means the underlying store failed.