acmadauth.auth module

class acmadauth.auth.HttpxDeviceFlowAuth(flow, cache, *, open_browser=False, show_qr=True, show_url=True, login_url_callback=None)

Bases: Auth

httpx.Auth that injects Bearer tokens and refreshes / device-logins as needed.

Parameters:
  • flow (KeycloakOIDCDeviceFlowHandler) – The device flow handler to use.

  • cache (TokenCache) – The token cache to use.

  • open_browser (bool) – Whether to open the browser automatically during device flow.

  • show_qr (bool) – Whether to display a QR code for the device flow URL.

  • show_url (bool) – Whether to display the device flow URL.

  • login_url_callback (Callable[[str], None] | None) – Optional callback function to receive the login URL.

auth_flow(request)

The auth flow that injects tokens into requests. Automatically refreshes or runs device flow as needed.

Parameters:

request (Request) – The outgoing HTTP request.

Return type:

Generator[Request, Any, None]

Returns:

The modified request with Authorization header.

requires_request_body = False
class acmadauth.auth.RequestsDeviceFlowAuth(flow, cache, *, open_browser=False, show_qr=True, show_url=True, login_url_callback=None)

Bases: AuthBase

requests auth module that injects Bearer tokens and refreshes / device-logins as needed.

Parameters:
  • flow (KeycloakOIDCDeviceFlowHandler) – The device flow handler to use.

  • cache (TokenCache) – The token cache to use.

  • open_browser (bool) – Whether to open the browser automatically during device flow.

  • show_qr (bool) – Whether to display a QR code for the device flow URL.

  • show_url (bool) – Whether to display the device flow URL.

  • login_url_callback (Optional[Callable[[str], None]]) – Optional callback function to receive