authorize
suspend fun authorize(credentials: OAuthClientCredentials, onCode: suspend (DeviceCode) -> Unit, shouldCancel: () -> Boolean = { false }, pollInterval: Duration? = null, timeout: Duration? = null, deviceId: String = randomDeviceId(), deviceName: String = DEFAULT_DEVICE_NAME): OAuthToken
Runs the complete OAuth Device Flow and installs the resulting access token in the client.
onCode is invoked once so the application can display DeviceCode.verificationUrl and DeviceCode.userCode. Coroutine cancellation is propagated unchanged. shouldCancel offers an additional cooperative cancellation hook for callers that cannot cancel the coroutine. The caller remains responsible for storing OAuthToken.refreshToken securely.