[GH-ISSUE #2322] Unexpected behaviour when syncing groups from IdP(Zitadel) #4898

Open
opened 2026-08-05 01:00:16 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @1ndef1n1te on GitHub (Jul 25, 2024).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/2322

Describe the problem

We have successfully configure auto-groups sync from IdP (Zitadel) to Nebird. When we add user to some group or several groups it will appear in Netbird dashboard. Removing users from groups seems work fine while there are more than 1 group for user in Zitadel. But we have noticed that if the user has only one group in IdP and we remove this user from this group, it is still a part of this group in Netbird.

To Reproduce

Steps to reproduce the behavior:

  1. In Zitadel, go to Authorizations and add one role for some user
  2. Ensure that now user a part of this role in Netbird dashboard
  3. Remove this user from this group in Zitadel
  4. See that this user still a prat of this group in Netbird dashboard even after reload or relogin.

Expected behavior

User is not a member of any group, like in IdP (Zitadel)

Are you using NetBird Cloud?

I am using self-hosted NetBird.

NetBird version

netbirdio/dashboard:v2.4.1
netbirdio/management:0.28.6
netbirdio/signal:0.28.6
coturn/coturn:latest

NetBird status -d output:

Skip

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Zitadel configuration:

Custom action in Zitadel with following content:

function flatRoles(ctx, api) {
  if (ctx.v1.user.grants == undefined || ctx.v1.user.grants.count == 0) {
    return;
  }

  let grants = [];
  ctx.v1.user.grants.grants.forEach(claim => {
    claim.roles.forEach(role => {
        grants.push(role)  
    })
  })

  api.v1.claims.setClaim('groups', grants)
}

Flow: Complement token, Triggers: Pre Userinfo creation, Pre access token creation

Netbird configuration

  1. Settings -> Groups -> Enable JWT group sync and JWT claim = groups
Originally created by @1ndef1n1te on GitHub (Jul 25, 2024). Original GitHub issue: https://github.com/netbirdio/netbird/issues/2322 **Describe the problem** We have successfully configure auto-groups sync from IdP (Zitadel) to Nebird. When we add user to some group or several groups it will appear in Netbird dashboard. Removing users from groups seems work fine **while** there are more than 1 group for user in Zitadel. But we have noticed that if the user has **only** one group in IdP and we remove this user from this group, it is still a part of this group in Netbird. **To Reproduce** Steps to reproduce the behavior: 1. In Zitadel, go to `Authorizations` and add **one** role for some user 2. Ensure that now user a part of this role in Netbird dashboard 3. Remove this user from this group in Zitadel 4. See that this user **still a prat of this group** in Netbird dashboard even after reload or relogin. **Expected behavior** User is not a member of **any** group, like in IdP (Zitadel) **Are you using NetBird Cloud?** I am using self-hosted NetBird. **NetBird version** netbirdio/dashboard:v2.4.1 netbirdio/management:0.28.6 netbirdio/signal:0.28.6 coturn/coturn:latest **NetBird status -d output:** Skip **Screenshots** If applicable, add screenshots to help explain your problem. **Additional context** Zitadel configuration: Custom action in Zitadel with following content: ```javascript function flatRoles(ctx, api) { if (ctx.v1.user.grants == undefined || ctx.v1.user.grants.count == 0) { return; } let grants = []; ctx.v1.user.grants.grants.forEach(claim => { claim.roles.forEach(role => { grants.push(role) }) }) api.v1.claims.setClaim('groups', grants) } ``` Flow: `Complement token`, Triggers: `Pre Userinfo creation`, `Pre access token creation` Netbird configuration 1) `Settings` -> `Groups` -> `Enable JWT group sync` and `JWT claim` = `groups`
saavagebueno added the bugmanagement-servicezitadeljwt labels 2026-08-05 01:00:16 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#4898