OAuth2Client
class OAuth2Client
A cross-platform OAuth2 client for interacting with an Okta Authorization Server.
This client is storage-agnostic — it handles HTTP calls, token validation, and event emission but never persists tokens. To store tokens, use TokenCredentialManager:
// 1. Create the client
val client = OAuth2ClientBuilder.create(issuerUrl, clientId, scope).getOrThrow()
// 2. Perform a token request (e.g., from a flow class)
val tokenInfo = client.tokenRequest(formParams).getOrThrow()
// 3. Persist via TokenCredentialManager
val tokenData = TokenData(tokenInfo, client.configuration)
val credential = manager.store(tokenData).getOrThrow()Content copied to clipboard
Use OAuth2ClientBuilder to create an instance via the builder pattern.
On Android, the existing OAuth2Client class provides backward-compatible access with additional platform-specific features.
Functions
Link copied to clipboard
suspend fun deviceAuthorizationRequest(formParams: Map<String, String>): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/DeviceAuthorizationInfo>
Performs a device authorization request per RFC 8628.
Link copied to clipboard
Link copied to clipboard
suspend fun getUserInfo(accessToken: String): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/OidcUserInfo>
Performs the OIDC User Info call.
Link copied to clipboard
suspend fun introspectToken(tokenTypeHint: String, token: String): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/IntrospectInfo>
Performs a call to the Authorization Server to validate the specified token per RFC 7662.
Link copied to clipboard
suspend fun refreshToken(refreshToken: String): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/TokenInfo>
Attempt to refresh a token using the provided refresh token string.
Link copied to clipboard
Attempt to revoke the specified token.
Link copied to clipboard