Zitadel Actions Setup Guide
Overview #
This directory contains Zitadel Actions - JavaScript functions that execute during authentication flows to customize token claims and behavior.
Actions #
1. set-groups-claim.js #
Purpose: Inject custom groups claim into OIDC tokens since Google OAuth doesn’t provide group information.
Behavior:
- Admin users get:
["admin", "consoleAdmin", "user"] - Existing admin users also get
rustfs_policies: ["consoleAdmin"]. - Regular users get:
["user"] - Unapproved users get: no groups (effectively denied)
Installation Steps #
Step 1: Create the Action in Zitadel Console #
- Navigate to https://zitadel.damacus.io
- Go to Actions in the left sidebar
- Click “New Action”
- Fill in the form:
- Name:
setGroupsClaim - Script: Copy the contents of
set-groups-claim.js - Timeout: 10s (default)
- Allowed to fail: No (unchecked)
- Name:
- Click “Save”
Step 2: Attach Action to Flow #
- Go to Flows in the left sidebar
- Find the “Complement token” flow
- Click “Add Trigger”
- Select:
- Flow Type:
Complement token - Trigger Type:
Pre Userinfo creation - Action:
setGroupsClaim(the action you just created)
- Flow Type:
- Click “Save”
- Repeat the trigger setup for:
- Flow Type:
Complement token - Trigger Type:
Pre access token creation - Action:
setGroupsClaim
- Flow Type:
The userinfo trigger adds groups to ID tokens, userinfo responses, and
introspection responses. The access-token trigger adds groups to JWT access
tokens. OAuth2 Proxy requires the userinfo trigger when enforcing
--allowed-group.
Step 3: Verify Action is Active #
- Go back to Actions
- Find
setGroupsClaim - Ensure it shows as “Active” and attached to both Complement Token triggers
Testing #
After installation, test the groups claim:
- Log in to Mealie as admin user
- Check that you have admin privileges
- Log in as regular user
- Check that you have standard user access
Debug Token Claims #
To see the actual token claims:
# Get an access token from Zitadel
# Then decode it at <https://jwt.io> to inspect claims
You should see:
{
"groups": ["admin", "consoleAdmin", "user"] // for admin
// or
"groups": ["user"] // for regular users
}
Updating the User List #
To add or remove users:
- Edit
set-groups-claim.js - Update the
adminEmailsorapprovedEmailsarrays - Go to Zitadel Console → Actions →
setGroupsClaim - Update the script
- Save
Changes take effect immediately on next login.
Troubleshooting #
Groups claim not appearing in tokens #
- Verify Action is attached to “Complement token” flow
- Check Action execution logs in Zitadel Console
- Ensure user email matches exactly (case-sensitive)
User denied access despite being in list #
- Check that OIDC application (Mealie) is requesting
groupsscope - Verify
OIDC_GROUPS_CLAIM=groupsin Mealie config - Check Mealie logs for OIDC errors
Action execution errors #
- Review Action logs in Zitadel Console
- Check JavaScript syntax
- Ensure
ctx.v1.user.emailis available
RustFS policy mapping #
RustFS uses rustfs_policies for both claim_name and groups_claim.
Leave role_policy empty: a fixed admin policy would grant every authenticated
user administrator access. General groups remain unchanged for other apps.
Only the existing admin email list receives the dedicated RustFS claim.
Keep the existing OIDC client ID, secret, callback and strict audience validation.
These provider settings are persisted in RustFS; update the existing Zitadel
action in place so its trigger attachments remain intact.
Run node --test tests/test_zitadel_groups_action.cjs to verify admin access
and denial for regular, unknown and machine users.
The action accepts both string email fields and the Email objects returned by Zitadel 4.19.4. Both formats use the same exact approved email lists.
Rollout acceptance recorded on 15 October 2026 #
The persisted production provider uses rustfs_policies for both claim_name
and groups_claim, with an empty role_policy. The existing client ID and
secret are retained, and additional audiences are explicitly allowlisted.
| Access case | Evidence | Result |
|---|---|---|
| Existing administrator signs in through Zitadel at the original RustFS URL | Live SSO callback succeeded; authenticated bucket browser loaded | Passed |
Regular approved user receives general user group without a RustFS policy |
Action executed in isolation with string and wrapped email values | Passed in isolation; live login unverified |
| Unknown or machine user receives no RustFS policy | Action executed in isolation through both entry points | Passed in isolation; live denial unverified |
The 28 Node cases verify claim generation, not end-to-end authorisation. A live non-admin sign-in remains required before claiming the denied-login acceptance case has passed. Use an existing non-admin account without changing its roles; confirm RustFS denies access and does not issue a usable console session. Do not save tokens or credentials in the evidence. Temporary diagnostic claims and RustFS debug logging have been removed.
Chart versions and upstream documentation: Helm chart reference.