Reference
Embassy User
User account, AI, payment, Service, and current identity APIs.
Create an Embassy with only the Federation URL, then use its user identity domain.
import { Embassy } from "@downcity/federation";
const embassy = new Embassy({ federation_url: "https://fed.example.com" });
const providers = await embassy.user.account.providers();Account
await embassy.user.account.login({
provider: "email",
bureau_id: "product-web",
input: { email: "user@example.com", password: "password" },
});
const current_user = await embassy.user.current();
const user_token = embassy.user.account.token();
await embassy.user.account.logout();bureau_id belongs to the login request, not the Embassy constructor. A successful login updates
the User Token held by this instance. You may also provide an existing user_token when creating
the Embassy.
Services
const models = await embassy.user.ai.catalog();
const methods = await embassy.user.payment.methods();
const services = await embassy.user.list_services();
const result = await embassy.user.service("rewrite")
.action("formal")
.invoke({ text: "hello" });embassy.user.get() and post() target the trusted Bureau server resolved by Federation from the
current User Token. Embassy rejects forwarding that token to another origin.