MCPcopy
hub / github.com/opentrace/opentrace / _ensure_client

Function _ensure_client

agent/src/opentrace_agent/cli/auth.py:142–156  ·  view source on GitHub ↗

Return a registered client, creating one via dynamic registration if needed.

(disco: dict[str, Any], redirect_uris: list[str])

Source from the content-addressed store, hash-verified

140
141
142def _ensure_client(disco: dict[str, Any], redirect_uris: list[str]) -> dict[str, Any]:
143 """Return a registered client, creating one via dynamic registration if needed."""
144 existing = load_client()
145 if existing is not None:
146 return existing
147
148 reg_endpoint = disco.get("registration_endpoint")
149 if not reg_endpoint:
150 raise RuntimeError(
151 "Authorization server does not support dynamic client registration "
152 "(no registration_endpoint in discovery document). "
153 "Register a client manually and save to ~/.opentrace/client.json"
154 )
155
156 return _register_client(reg_endpoint, redirect_uris)
157
158
159# ---------------------------------------------------------------------------

Callers 1

loginFunction · 0.85

Calls 3

load_clientFunction · 0.90
_register_clientFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected