Use Keycloak OAuth for a2amcp login
All checks were successful
build / test (push) Successful in 19s
publish / npm (push) Successful in 22s

This commit is contained in:
2026-05-31 20:46:17 -03:00
parent 1e034412ca
commit 2814112ab3
12 changed files with 584 additions and 53 deletions

View File

@@ -1,7 +1,4 @@
/**
* Thin control-plane client. Mirrors the relevant subset of
* a2a_pack.cli.api_client.ControlPlaneClient.
*/
/** Thin control-plane client used with Keycloak bearer tokens. */
export class ApiError extends Error {
constructor(public status: number, message: string) {
super(`API ${status}: ${message}`);
@@ -52,20 +49,6 @@ export class ControlPlaneClient {
return (await resp.json()) as T;
}
login(email: string, password: string) {
return this.request<{
access_token: string;
user: { id: number; email: string };
}>("POST", "/v1/auth/login", { email, password });
}
signup(email: string, password: string) {
return this.request<{
access_token: string;
user: { id: number; email: string };
}>("POST", "/v1/auth/signup", { email, password });
}
me() {
return this.request<{ id: number; email: string }>("GET", "/v1/me");
}