satorbis_kit.auth.callback_server module

auth.callback_server

Starts a single-use local HTTP server that listens for the OAuth2 authorization-code redirect and returns the full callback URL.

Designed to run in a background daemon thread so it does not block the Jupyter kernel.

satorbis_kit.auth.callback_server.get_callback_url(timeout_seconds: int = 300) str[source]

Block until the local server receives the OAuth redirect, then return the full callback URL (including ?code=...&state=...).

Parameters:

timeout_seconds – How long to wait. Raises TimeoutError if no callback arrives.

Returns:

Full callback URL, e.g. http://localhost:4200/callback?code=abc&state=xyz

Return type:

str

satorbis_kit.auth.callback_server.launch_callback_listener(port: int, timeout_seconds: int = 300) None[source]

Spawn a daemon thread that runs start_callback_server().

The thread is a daemon so it is automatically killed when the Jupyter kernel shuts down, with no cleanup needed.

satorbis_kit.auth.callback_server.start_callback_server(port: int, timeout_seconds: int = 300) None[source]

Start the callback HTTP server. Intended to be called inside a threading.Thread — it blocks until one request has been handled or timeout_seconds has elapsed.

Parameters:
  • port – Port to listen on (must match the redirect URI registered with the provider).

  • timeout_seconds – How long (in seconds) to wait for the callback before giving up.