OpenRouterOAuthLocalCallbackServer class final

A one-shot HTTP server that captures the OpenRouter OAuth callback on localhost.

Binds to 127.0.0.1:0 (any free port), serves a small success/error page, and completes with the authorization code from the first GET /?code=... request. The server closes itself automatically after the code is captured or after a timeout.

Constructors

OpenRouterOAuthLocalCallbackServer()
Creates a server that will bind to an ephemeral localhost port.

Properties

callbackUrl String?
The callback URL to pass to OpenRouter, or null before start.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Closes the server and cancels the timeout.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start({Duration timeout = const Duration(minutes: 5)}) Future<String>
Starts the server and returns the URL OpenRouter should redirect to.
toString() String
A string representation of this object.
inherited
waitForCode() Future<String?>
Waits for the callback and returns the authorization code, or null on timeout/error.

Operators

operator ==(Object other) bool
The equality operator.
inherited