refreshToken

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.

Important: This credential instance becomes stale after a successful refresh. Always use the returned credential for subsequent operations:

val fresh = credential.refreshToken().getOrThrow()
fresh.getUserInfo() // correct — uses refreshed token
// credential.getUserInfo() // wrong — uses old expired token

To observe token updates reactively (e.g., in a UI), use getTokenFlow which emits every time the token is refreshed for this credential ID, regardless of which snapshot triggered the refresh.

Uses a shared orchestrator for deduplication — concurrent calls for the same credential ID will coalesce into a single network request.

Return

Result.success with a new Credential snapshot containing the refreshed token, or Result.failure with:

  • IllegalStateException if no refresh token is available on this credential.

  • Other exceptions if the refresh network request fails.