/zitadel-idp:zitadel-idpfrom zitadel-idp
Field guide for self-hosted Zitadel v4 OIDC integration. Covers docker-compose setup, TypeScript bootstrap, and high-friction traps like JWKS over self-signed HTTPS, tlsMode external, API v1→v2 migration, and 401 storms.
Ships in zitadel-idp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
This skill captures patterns and pitfalls discovered while integrating Zitadel v4.x self-hosted as the IdP for a company ERP. It exists to prevent every new project from re-discovering the same gotchas the hard way.
Scope: Zitadel v4.x (latest as of 2026-04) is the default target. v3 differs in a few places (notably no OrganizationService.AddOrganization v2 endpoint) — the references flag breaking changes when relevant. v2.66.x is also covered for one specific edge case (Quirk 24, masterkey via flag) because legacy stacks still run it; the rest of the skill remains v4-first.
Out of scope: Zitadel Cloud (managed), v3 setup, SAML flows, federation IdPs (login with Google/GitHub), Login UI v2 customization. The skill assumes self-hosted, OIDC-only, with the bundled Login UI v1.
Read this skill before you start any of the following:
docker-compose.yml that includes ZitadelInstance not found, User with state initial, Method Not Allowed, Organisation doesn't exist, Errors.Instance.Domain.AlreadyExists, 404 {"code":5,"message":"Not Found"} na hosted UI, 400 em /oauth/v2/authorize?prompt=none, 401 com JWT cujos iss/aud/exp parecem corretos (especialmente atrás de proxy TLS local com cert self-signed), ou 400 COMMAND-1m88i "No changes" em bootstrap idempotentelocalhost/127.0.0.1 (acesso via LAN, IP .sslip.io, hostname custom) — exige HTTPS por causa do crypto.subtle (PKCE), e o consumer típico de react-oidc-context engole a rejeição do signinRedirectIf you are merely calling a pre-existing Zitadel deployment from your code, you probably only need references/token-validation.md and references/api-cheatsheet.md.
references/quirks.md (grep it by the error code, e.g. grep -n 'COMMAND-1m88i' references/quirks.md). If nothing matches, read references/troubleshooting.md, the symptom-first lookup.| When the task is… | Read |
|---|---|
| When bringing up Zitadel locally for the first time | references/docker-compose-bootstrap.md + use assets/docker-compose.zitadel.yml as starting point |
| When a local Zitadel is broken and must be reset | run scripts/reset-zitadel.sh |
| When closing public self-registration on an instance (both keys) and proving it | run scripts/close-public-registration.sh (it only reads without --apply) + Quirk 62 |
| When creating Org/Project/Roles/App programmatically | references/api-cheatsheet.md + copy assets/bootstrap-zitadel.ts (the idempotent template) |
| When validating Zitadel JWT in Node | references/token-validation.md |
When mapping domain tenantId to Zitadel orgId | references/tenant-org-mapping.md |
When wiring an SPA (React + react-oidc-context) — boot-time silent renew, F5 retention, logout flow | references/spa-recipes.md |
| When applying org branding to the hosted Login UI v1 (logo, colors, custom texts) | references/branding.md |
| When planning a v2.66.x → v4.x upgrade (pre-flight, snapshot, login UI v2 container, validation, rollback) | references/migration-v2-to-v4.md |
| When refactoring callers from Management API v1 to v2 (Connect protocol, payload diffs, idempotence patterns) | references/api-v1-to-v2-mapping.md |
| When running prod + staging Zitadels side by side, or moving users between instances | references/multi-instance-and-user-migration.md |
| When running a role rename/migration across environments (declare-first, the grant tool, per-environment state) | references/role-migration.md |
| When a Gotchas line below matches and you need its symptom, cause, fix and evidence | references/quirks.md |
| When you hit a confusing error and want a quick lookup | references/troubleshooting.md |
When proving a bootstrap actually wrote what the YAML declares, or reading who holds which role, with each account's e-mail, or the projectId and the org that owns it (no PAT needed) | references/troubleshooting.md §"The bootstrap logs reuse for everything" |
| When one account loops back to the login screen while others log in fine | references/troubleshooting.md §"One account loops back…" |
| When creating a test/seed user and proving its password works, with no browser | references/api-cheatsheet.md §"Seed an admin user" + §"Prove a user's password without a browser" |
| When provisioning real people's accounts by script — which PAT, the password policy, proving the password without locking anyone out | references/api-cheatsheet.md §"Provision real accounts by script" + Quirks 57, 58, 59 and 63 |
When driving the SPA's UI language from the user's IdP language (locale claim) | references/spa-recipes.md §"Recipe — UI language from the IdP" |
When changing an existing user's language (preferredLanguage) | references/api-cheatsheet.md §"Change an existing user's language" |
These bite first-time Zitadel integrators consistently. One line per quirk; the full text (symptom, cause, fix, measured evidence, and the file/section with the recipe) is in references/quirks.md under the same number — read it when a line here matches what you see. Numbers are stable: the references cite them as "Quirk N".
ZITADEL_FIRSTINSTANCE_* envs go on the zitadel service, not on zitadel-init./current-dir volume must be writable by uid 1000, or setup loops on permission denied.ZITADEL_EXTERNALDOMAIN is enforced via the Host header: calling 127.0.0.1:8080 answers Instance not found./admin/v1/orgs/_setup needs a human admin; create the org with v2 AddOrganization.userName + firstName/lastName, v2 username + givenName/familyName; v4 also rejects clockSkew > 5s.initialPassword stays initial, and _deactivate fails with COMMAND-ke0fw.tenantId ≠ orgId (numeric only when Zitadel mints it, Quirk 26); Management calls need it in x-zitadel-orgid./management/v1/users/grants/_search; the per-user path answers 405.loginV2.required=true is the default from v3 on; without the Login UI v2 container the authorize flow hits {"code":5,"message":"Not Found"}./silent-renew must be in the app's redirectUris, or every prompt=none returns 400 and the SPA loops.name, email, org id); fall back to sub.NODE_EXTRA_CA_CERTS; otherwise 100% of requests 401.projectId and clientId; re-derive them from bootstrap.json on every boot.PUT …/oidc_config with an unchanged body returns 400 COMMAND-1m88i "No changes"; treat it as a no-op.ZITADEL_EXTERNALSECURE=true, ZITADEL_TLS_ENABLED=false and --tlsMode external.crypto.subtle, which only secure contexts expose; over HTTP on a LAN IP or .sslip.io, "Entrar" silently does nothing.InMemoryWebStorage needs a boot-time signinSilent, guarded against re-mounting inside the /silent-renew iframe.post_logout_redirect_uri is byte-matched like redirect_uri (post_logout_redirect_uri invalid).privateLabelingSetting to enforce the owner's policy.Org-0K9dq), and a no-op re-run answers Org-8nfSr, not COMMAND-1m88i./assets/v1/org/policy/label/...; the old orgs/me path answers 405./management/v1/text/login/{lang} and accept short codes only (pt-BR → LANG-lg4DP).dev.sh must win over the YAML (redirect_uri is missing in the client configuration).start-from-init does not reliably read ZITADEL_MASTERKEY (panic: No master key provided); pass --masterkey, and from then on read ps and docker inspect (Args, Config.Cmd, Config.Env) by count or length: dumped whole, they print the key.ghcr.io/zitadel/zitadel-login): deploy it or turn loginV2.required off, and pick one.ALREADY_EXISTS as success.missing organization_id).Awaiting file and reading token or Errors.Instance.Domain.AlreadyExists).client_id is the numeric clientId, not your applicationId UUID (Errors.App.NotFound).ZITADEL_BOOTSTRAP_ENV must be set explicitly in CD (it silently defaults to dev), and bootstrap.json refreshes only when the bootstrap runs.ZITADEL_DEFAULTINSTANCE_FEATURES_LOGINV2_REQUIRED=false at FirstInstance breaks the Quirk 25 + 28 deadlock.VIRTUAL_PATH hides the container without one; declare VIRTUAL_PATH=/ + VIRTUAL_DEST=/.userLoginMustBeDomain=true stamps loginNames on existing users, and turning it off does not undo it.extra_hosts: idp.<domain>:host-gateway (401 storm ~10 min after restart).ApiClient, no retry on 401, a guarded redirect listener.ZITADEL_FIRSTINSTANCE_PATPATH fail with EACCES, which cascades into unique_constraints_pkey (not Quirk 28).openssl rand -hex fails with COMMAND-VoaRj.zitadel-login takes 90 s or more to go healthy on small CI runners; scope up --wait.roleKeys when the YAML gains a role.OPTIONS 401s (looks like the 401-storm family).[unknown] Failed to fetch: environment.json renders api: http against issuer: https under --tlsMode disabled; recreate the container, never docker start.client_id + redirect_uri with no credential: /oauth/v2/authorize must answer 302 …/ui/login/login.ZITADEL_SEED_USER_ROLE must list the roles of every app sharing the IdP; the create path writes it literally.ListProjectRoles has no Connect/v2 twin (404); use REST v1 roles/_search.env > YAML > default.reuse for every resource can mean a stale input; prove it with the creation_date in projections.project_roles4.403 is the honest status.locale claim (id_token only with idTokenUserinfoAssertion: true, null when unset, which the v2 API shows as und).sub, or require email_verified.x-zitadel-orgid: with the user's org it finds nothing for a grant that lives in the org owning the project, and that empty result turns an update (PUT) into a duplicate create (POST).PUT answers 200, POST /v2/users can still return the old value; poll before concluding the write was ignored, and do not repeat it.POST /v2/users answers 200 with zero results for an account in another org, and creating it then duplicates the email (Quirk 54); probe with /admin/v1/orgs/_search first (403 AUTH-5mWD2).maxPasswordAttempts the account is USER_STATE_LOCKED, and even the right password then answers Errors.User.NotActive (SESSION-Gj4ko).passwordChangeRequired: false; for real people, create through the API with password.changeRequired: true.users13 next to users14), and the older one is frozen since the upgrade; projections.current_states says which one is live.allowRegister): with no SMTP the person is stuck on the code screen, the account lands in the instance's default org out of an org-scoped PAT's sight, and SMTP must wait for that decision; org registration is a second key (disallowPublicOrgRegistration), and a closed person page still answers 200.401 Errors.Token.Invalid (AUTH-7fs1e)), and each batch needs a new PAT.When upgrading from v2.66.x to v4.x and refactoring callers from API v1 to v2:
references/migration-v2-to-v4.md — pre-flight (Postgres required since v3, advisory A10015), upgrade path (direct v2.66 → v4 OK if Postgres in place — no v3 stop), schema migration runs automatically in the v4 image's setup phase, validation matrix, rollback.references/api-v1-to-v2-mapping.md when refactoring calls — covers all 15 v2 services (Organization, Project, Application, User, Authorization, Action, Feature, Settings, OIDC, IDP, Group, SAML, Session, WebKey, Instance), payload diffs (firstName/lastName → givenName/familyName, userName → username, email.isEmailVerified → email.isVerified, language pt-BR → pt), and idempotence patterns./ui/v2/login to zitadel-login:3000, everything else (including OIDC discovery, OAuth, JWKS) to zitadel:8080. Path B (sticking with Login UI v1) is supported — Login UI v1 keeps working at /ui/login/ indefinitely._search-then-create round-trip. Existing v1-shaped bootstrap scripts keep working in v4; refactor only when there's a reason.Authorization: Bearer <PAT> header. JSON variant uses Content-Type: application/json. Binary variant uses application/connect+proto (only if you have a generated client).For a fresh project, this sequence avoids most reordering:
assets/docker-compose.zitadel.yml and adjust ports / external domain. Read docker-compose-bootstrap.md §1-3 first — the env layout is non-obvious.docker compose up -d, wait for healthy, verify the PAT was written to <volume>/admin.pat. If not, see troubleshooting.assets/bootstrap-zitadel.ts and run it to create your Org/Project/Roles/App. The script is idempotent — re-runs are safe.projectId and clientId from the output JSON. These become OIDC_AUDIENCE and the SPA's client_id respectively.token-validation.md. The audience must equal the projectId, NOT the clientId.http://<external-domain>/.well-known/openid-configuration.troubleshooting.md.ZITADEL_EXTERNALSECURE=true + ZITADEL_TLS_ENABLED=false + start flag --tlsMode external (full triad — see docker-compose-bootstrap.md §"TLS terminated by reverse proxy", quirk 15). Backup the Zitadel Postgres database like any other Postgres.migration-v2-to-v4.md), not v3 as an intermediate stop.assets/bootstrap-zitadel.ts (idempotent bootstrap) and assets/docker-compose.zitadel.yml.When the references in this skill diverge from upstream, trust the upstream docs but raise a note — Zitadel evolves quickly and these references will drift.
CHANGELOG.md (opens in a new tab)assets/bootstrap-zitadel.ts (opens in a new tab)assets/docker-compose.zitadel.yml (opens in a new tab)references/api-cheatsheet.md (opens in a new tab)references/api-v1-to-v2-mapping.md (opens in a new tab)references/branding.md (opens in a new tab)references/docker-compose-bootstrap.md (opens in a new tab)references/migration-v2-to-v4.md (opens in a new tab)references/multi-instance-and-user-migration.md (opens in a new tab)references/quirks.md (opens in a new tab)references/role-migration.md (opens in a new tab)references/spa-recipes.md (opens in a new tab)references/tenant-org-mapping.md (opens in a new tab)references/token-validation.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)scripts/close-public-registration.sh (opens in a new tab)scripts/reset-zitadel.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub j0ruge/skills --plugin zitadel-idpOther plugins' skills for the same job