mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
# Which Problems Are Solved Pages in `apps/docs` that embed source from GitHub via the Docusaurus convention ```` ```js reference https://github.com/zitadel/actions/blob/main/examples/org_metadata_claim.js ``` ```` stopped working after the migration from Docusaurus to fumadocs. The old `docusaurus-theme-github-codeblock` plugin used to fetch the file and render it; fumadocs has no support for that meta, so the page rendered the raw URL as plain code-block text. Visible at `/docs/apis/actions/code-examples` and 16 other pages. # How the Problems Are Solved - Converted every ```` ```<lang> reference\n<URL>\n``` ```` block (46 total across 17 `.mdx` files) to the native fumadocs JSX form: `<GithubCodeBlock url="<URL>" />`. The existing `<details>`/`<summary>` collapsibles around blocks are kept — they're an authoring choice, not part of the rendering bug. - Updated `apps/docs/components/github-code-block.tsx` to render via `DynamicCodeBlock` from `fumadocs-ui/components/dynamic-codeblock` (proper shiki highlighting) instead of raw `CodeBlock` + `Pre` (which produced unhighlighted output). Also fixed language detection so a URL hash like `#L10-L20` no longer pollutes the language token. - Registered `GithubCodeBlock` globally in `apps/docs/mdx-components.tsx`, matching how every other shared component (`APIPage`, `Callout`, `Tab/Tabs`, `Step/Steps`, `Admonition`, `TerminologyUpdate`) is exposed. MDX files no longer need a local `import`. # Additional Changes - Normalized the two MDX files that were already using the JSX form (`examples/secure-api/python-django.mdx`, `examples/secure-api/java-spring.mdx`): removed their now-redundant local `import { GithubCodeBlock }` and rewrote 9 long-form `<GithubCodeBlock url="..."></GithubCodeBlock>` tags to self-closing for consistency. # Additional Context Verified locally with `pnpm --filter @zitadel/docs dev`: - `/docs/apis/actions/code-examples` — 20 shiki-highlighted code blocks rendered inside the `<details>` collapsibles (was 0). - `/docs/apis/openidoauth/claims` — line-range hashes (`#L9-L11`) honored. - `/docs/examples/login/flutter` — mixed languages (xml/dart/html) detected and highlighted. - `/docs/guides/integrate/external-audit-log` — edge case of fenced reference indented inside a numbered list also converted and rendered. Greps: - `^[ \t]*\`\`\`[a-zA-Z0-9]+ reference` in `apps/docs/content/**/*.mdx` → 0 matches. - `<GithubCodeBlock url="` in `apps/docs/content/**/*.mdx` → 55 matches. - `from '@/components/github-code-block'` in `apps/docs/content/**/*.mdx` → 0 matches. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
50 lines
2.1 KiB
Plaintext
50 lines
2.1 KiB
Plaintext
---
|
|
title: Behavior Customization
|
|
description: "Assign user roles during registration via external identity providers using ZITADEL actions."
|
|
---
|
|
|
|
In this guide, you will create a [ZITADEL action](../../../concepts/features/actions).
|
|
After users register using an external identity provider, the action assigns them a role.
|
|
|
|
## Prerequisites
|
|
|
|
Before you start, make sure you have everything set up correctly.
|
|
|
|
- You need to be at least a ZITADEL _ORG_OWNER_
|
|
- Your ZITADEL organization needs to have the actions feature enabled. - [Your ZITADEL organization needs to have at least one external identity provider enabled](../../integrate/identity-providers/introduction)
|
|
- [You need to have at least one role configured for a project](../console/projects)
|
|
|
|
## Copy some information for the action
|
|
|
|
1. Select the **Projects** navigation item.
|
|
2. Select a project that has a role configured.
|
|
3. Copy the Project ID on the screens top right.
|
|
4. Scroll to the **ROLES** section and note some roles key.
|
|
|
|
## Create the action
|
|
|
|
1. Select the **Actions** navigation item.
|
|
2. In the **Actions <i className="las la-code"></i>** section, select the **+ New** button.
|
|
3. Give the new action the name `addGrant`.
|
|
4. Paste this snippet into the multiline text-field.
|
|
5. Replace the snippets placeholders and select **Save**.
|
|
|
|
<GithubCodeBlock url="https://github.com/zitadel/actions/blob/main/examples/add_user_grant.js" />
|
|
|
|
## Run the action when a user registers
|
|
|
|
Now, make the action hook into the [external authentication flow](/apis/actions/external-authentication).
|
|
|
|
1. In the **Flows <i className="las la-exchange-alt"></i>** section, select the **+ New** button.
|
|
2. Select the **Flow Type** _External Authentication_.
|
|
3. Select the **Trigger Type** _Post Creation_.
|
|
4. In the **Actions** dropdown, check _addGrant_.
|
|
5. Select the **Save** button.
|
|
|
|
New users automatically are assigned a role now if they register by authenticating with an external identity provider.
|
|
|
|
## What's next?
|
|
|
|
- [Read more about the concepts around actions](/concepts/features/actions)
|
|
- [Read more about all the options you have with actions](/guides/manage/console/actions-overview)
|