Return a registered client, creating one via dynamic registration if needed.
(disco: dict[str, Any], redirect_uris: list[str])
| 140 | |
| 141 | |
| 142 | def _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 | # --------------------------------------------------------------------------- |
no test coverage detected