Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.75 KB

File metadata and controls

46 lines (33 loc) · 1.75 KB

@zitadel/sdk-qwik

Qwik components for the Zitadel auth UI, for client-side SPAs (Vite, etc.).

Requirements

TypeScript ≥ 5.0 — the published type definitions re-export with export type *, which TypeScript introduced in 5.0.

Usage

import { component$ } from '@builder.io/qwik';
import { ZitadelLogin, configureZitadel } from '@zitadel/sdk-qwik';

export default component$(() => {
  const project = configureZitadel({
    projectId: import.meta.env.VITE_ZITADEL_PROJECT_ID,
    proxyPath: '/__nextgen',
  });

  return <ZitadelLogin project={project} purpose="login" postSignInUrl="/" />;
});

<ZitadelLogout project={project} postSignOutUrl="/login" /> works the same way.

The widget's flow events are surfaced as optional QRL callbacks: onFlowStep$, onFlowInput$, onFlowComplete$, and onFlowError$.

The SDK binds project (and the discrete projectId / proxyPath) to the element as DOM properties, the same as the other framework SDKs.

Proxying to the backend (deployment)

The widgets call ${proxyPath}/… same-origin (default /__nextgen). A SPA has no server, so in production the path comes from your hosting platform — a vercel.json rewrite, a netlify.toml redirect, or a minimal Cloudflare worker — with no secrets on the platform, per ADR 036. CLI scaffolding for these configs is tracked in zitadel/nextgen#560. Until that work lands, production SPA deployment is not yet supported — the CLI dev proxy covers local development.

For local development you can skip the proxy and point proxyPath straight at the backend (cross-origin), e.g. proxyPath: "http://localhost:4000".