AuthorizationCodeFlow

A Java-friendly wrapper around the Kotlin KotlinAuthorizationCodeFlow.

This class combines the start and resume steps into a single start method that uses a BrowserRedirectHandler to open the browser and capture the redirect callback. Java consumers can use CompletableFuture without dealing with Kotlin coroutines.

Typical Java usage:

AuthorizationCodeFlow flow = new AuthorizationCodeFlow(kmpClient);
TokenInfo token = flow.start(redirectUrl, browserHandler, scope).get();
flow.close();

Must be closed when no longer needed to release coroutine resources.

Pushed Authorization Requests (PAR) note: because this wrapper performs the full start+resume round trip internally, the intermediate com.okta.oauth2.kmp.AuthorizationCodeFlowContext — including usedPushedAuthorizationRequest/pushedAuthorizationRequestUri — is never constructed as a value Java callers can observe; it's an intermediate flowContext local in start below. PAR itself is fully supported here and is configured on the client via OAuth2ClientBuilder.setEnablePushedAuthorizationRequests/setAllowPushedAuthorizationRequestFallback — only the diagnostic "did this call use PAR" signal is unavailable to Java callers. The two PAR failure exceptions (KotlinAuthorizationCodeFlow.PushedAuthorizationRequiredException and KotlinAuthorizationCodeFlow.PushedAuthorizationRequestException) propagate normally through the returned CompletableFuture (retrievable via ExecutionException.getCause()), so no error information is lost — only the successful-PAR-usage signal.

Parameters

delegate

the underlying Kotlin KotlinAuthorizationCodeFlow instance.

Constructors

Link copied to clipboard
constructor(delegate: AuthorizationCodeFlow)
constructor(client: OAuth2Client)

Creates an AuthorizationCodeFlow backed by the given KmpOAuth2Client.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun start(redirectUrl: String, browserRedirectHandler: BrowserRedirectHandler, scope: List<String>, extraRequestParameters: Map<String, String> = emptyMap()): CompletableFuture<TokenInfo>

Performs the full Authorization Code flow asynchronously.