···55from aiohttp import web
667788-async def wait_for_callback(port: int = 23847) -> dict:
88+async def wait_for_callback(port: int = 23847, timeout: float = 90.0) -> dict:
99 """Start a local server and wait for the OAuth callback.
10101111 Returns dict with 'code', 'state', and 'iss' from the callback query params.
···3939 ) from e
40404141 try:
4242- await event.wait()
4242+ try:
4343+ await asyncio.wait_for(event.wait(), timeout=timeout)
4444+ except asyncio.TimeoutError:
4545+ raise RuntimeError(
4646+ f"Timed out waiting for OAuth callback after {int(timeout)}s."
4747+ ) from None
4348 finally:
4449 await runner.cleanup()
4550