Fill in the server pieces
The compact example above names four application objects. components maps every choreography name to an implementation. channels delivers sendable prompts. secret signs tokens and encrypts flow state. storage keeps identities, sessions, temporary values, and rate-limit counters.
Set app.basePath when the routes should live below a prefix, then give the same prefix to AuthDanceClient.
const auth = createAuthDance({
api: { choreography, components, channels, secret, storage },
app: { basePath: "/api/auth" },
info: { title: "Auth API", version: "1.0.0" },
});
Deno.serve(auth.fetch);
Answer every prompt kind
A flow alternates between server responses and client answers. For an input prompt, render the field described by dance.current and call submitPrompt(value). If that prompt is sendable, call sendPrompt() to ask its channel to deliver a value first.
For a choice prompt, render dance.choices and call choose(name). Keep answering until dance.done is true.
while (!dance.done) {
if (dance.prompt?.kind === "choice") {
await dance.choose(await chooseBranch(dance.choices));
} else {
if (dance.current?.sendable) await dance.sendPrompt();
await dance.submitPrompt(await readValue(dance.current!));
}
}
Continue with the real adapters
Use the next guides to configure a full server and client loop. Then choose the React bindings or drive the client directly. The factor and provider guides cover the built-in components, Deno KV, Cloudflare storage, and custom interfaces.
Try signing in with the demo beside this guide. It runs Auth Dance in your browser with temporary accounts and a local inbox. Choose another authentication flow to try email codes or passkeys.