/** * Temporary HTTP callback server for OAuth2 redirect. * * Starts a minimal HTTP server that waits for the OAuth callback, * captures the authorization code, and shuts down. * Uses only `node:http` — no external dependencies. */ /** Result from the callback server after receiving the OAuth redirect */ export interface CallbackResult { code: string; state: string; } /** Handle returned immediately when the server starts listening */ export interface CallbackServerHandle { /** The actual port the server is listening on (useful when port: 0 is passed) */ port: number; /** Promise that resolves with the OAuth result or rejects on error/timeout */ result: Promise; } /** Options for the callback server */ export interface CallbackServerOptions { /** Loopback host to bind. Default: 127.0.0.1 */ host?: string; /** Port to listen on. Default: 3000 */ port?: number; /** Callback pathname to accept. Default: /callback */ callbackPath?: string; /** State parameter to validate against (CSRF protection) */ expectedState: string; /** How long to wait before timing out in ms. Default: 120_000 (2 min) */ timeoutMs?: number; } /** * Start a temporary HTTP server that waits for the OAuth callback. * * Returns a {@link CallbackServerHandle} immediately — `handle.port` reflects * the OS-assigned port when `options.port` is `0`, and `handle.result` is the * promise that resolves with the authorization code and state once the callback * is received. The server shuts down automatically after a callback or timeout. * * Pass `port: 0` (recommended) to let the OS pick a free port and avoid * port-collision errors in environments with parallel processes. */ export declare function startCallbackServer(options: CallbackServerOptions): CallbackServerHandle; //# sourceMappingURL=callback-server.d.ts.map