LoopbackReceiver

A one-shot HTTP listener on the loopback interface for an OAuth redirect (RFC 8252 §7.3). Bound to 127.0.0.1 only — never reachable from the network.

Open it before sending the user to the browser, then awaitCode.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun awaitCode(expectedState: String?, timeoutMs: Long = 5 * 60_000L): String

Waits for the redirect and returns the authorization code after checking expectedState (CSRF). Answers the browser with a small page telling the user to return to the app. Requests to other paths (a favicon, a probe) are answered 404 and ignored.

Link copied to clipboard
open override fun close()