DeviceAuthApi

OAuth Device Flow operations.

Functions

Link copied to clipboard
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.

Link copied to clipboard
suspend fun pollDeviceToken(deviceCode: String, credentials: OAuthClientCredentials): OAuthToken?

Polls once for an OAuth token. Returns null while user confirmation is pending.

Link copied to clipboard
suspend fun requestDeviceCode(credentials: OAuthClientCredentials, deviceId: String = randomDeviceId(), deviceName: String = DEFAULT_DEVICE_NAME): DeviceCode

Requests a user code that can be confirmed in a browser.