Credential

Cross-platform credential interface providing token management operations.

Instances are immutable snapshots: token, tags, and id never change after construction. Methods that modify credential state return a Result containing a new Credential snapshot.

On Android, the existing com.okta.authfoundation.credential.Credential class implements this interface while preserving mutable internal behavior as a transitional adapter. On JVM and other KMP targets, CredentialImpl provides the default immutable implementation.

Inheritors

Properties

Link copied to clipboard
abstract override val id: String

Unique identifier for this credential.

Link copied to clipboard
abstract val tags: Map<String, String>

The tags associated with this credential (point-in-time snapshot).

Link copied to clipboard
abstract val token: TokenInfo

The token associated with this credential (point-in-time snapshot).

Functions

Link copied to clipboard

Returns the access token string if it has not expired, or null if it has.

Link copied to clipboard
abstract suspend fun deleteAsync(): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Deletes this credential from storage.

Link copied to clipboard
abstract fun getTokenFlow(): ERROR CLASS: Symbol not found for Flow<com/okta/authfoundation/client/TokenInfo>

Returns a Flow that emits the current token and subsequent updates.

Link copied to clipboard
abstract suspend fun getUserInfo(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/OidcUserInfo>

Fetches user info from the authorization server.

Link copied to clipboard
abstract fun idToken(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/jwt/Jwt>

Retrieves the parsed Jwt from the ID token.

Link copied to clipboard
abstract suspend fun introspectToken(tokenType: TokenType): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/IntrospectInfo>

Introspects a specific token type at the authorization server.

Link copied to clipboard
abstract suspend fun refreshIfExpired(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Ensures the credential has a non-expired access token, refreshing if necessary.

Link copied to clipboard
abstract suspend fun refreshToken(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Refreshes the token and returns a new credential snapshot.

Link copied to clipboard
abstract suspend fun revokeAllTokens(): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Revokes all available token types (access token, refresh token, device secret).

Link copied to clipboard
abstract suspend fun revokeToken(tokenType: RevokeTokenType): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Revokes a specific token type at the authorization server.

Link copied to clipboard
abstract fun scope(): String

Returns the scopes associated with the token, or the client's default scopes. Pure read.

Link copied to clipboard
abstract suspend fun setTagsAsync(tags: Map<String, String>): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Updates the tags for this credential and returns a new snapshot.