AuthorizationCodeFlow

Encapsulates the behavior required to authenticate using the OIDC Authorization Code flow with PKCE.

Call start to obtain an AuthorizationCodeFlowContext whose AuthorizationCodeFlowContext.url you open with a BrowserRedirectHandler. Once the browser redirects back to the registered redirect URI, pass that captured URI along with the same AuthorizationCodeFlowContext to resume to exchange the authorization code for tokens.

See Authorization Code Flow documentation

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Thrown by resume when no authorization code is present in the redirect URI.

Link copied to clipboard

Common base for the two exceptions start throws when Pushed Authorization Requests (PAR) cannot be completed. Catch this type to handle "PAR didn't work" generically, or catch the specific subtype (PushedAuthorizationRequiredException or PushedAuthorizationRequestException) to distinguish a server-mandated failure from an optional one.

Link copied to clipboard

Thrown by start when PAR is optional, the PAR request fails, and OAuth2Client.configuration's allowPushedAuthorizationRequestFallback is disabled.

Link copied to clipboard

Thrown by start when PAR is required by the authorization server (require_pushed_authorization_requests) but cannot be used — either no PAR endpoint was discovered, or the PAR request itself failed and fallback is not applicable because the server mandates PAR.

Link copied to clipboard

Thrown by resume when the redirect URI scheme does not match the configured redirect URL.

Link copied to clipboard
class ResumeException(message: String, val errorId: String) : Exception

Thrown by resume when the redirect could not be validated or the authorization server returned an error.

Properties

Link copied to clipboard
abstract val client: ERROR CLASS: Symbol not found for OAuth2Client

The OAuth2Client instance used for token requests.

Functions

Link copied to clipboard
abstract suspend fun resume(uri: String, flowContext: AuthorizationCodeFlowContext): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for TokenInfo>

Completes the Authorization Code redirect flow by exchanging the authorization code for tokens.

Link copied to clipboard

Resumes the Authorization Code flow using an Android android.net.Uri.

Link copied to clipboard
abstract suspend fun start(redirectUrl: String, scope: List<String> = client.configuration.defaultScope, extraRequestParameters: Map<String, String> = emptyMap()): ERROR CLASS: Symbol not found for Result<com/okta/oauth2/kmp/AuthorizationCodeFlowContext>

Initiates the Authorization Code redirect flow.