I am using Keycloak version 23.0.0. I am attempting to configure the default client scope to enable user groups in the JWT token. I am using the direct grant flow to generate an access token. I have reviewed Stack Overflow and the Keycloak community, but my issue remains unresolved. I have attached screenshots of my client scope and Group Membership mapper. Any quick help would be greatly appreciated. I have also double checked my user group & users all configuration seems fine there.
Here is my current jwt token
alg: "RS256",
typ: "JWT",
kid: "vL8kIqWQFfX6oj-gN64xZibBqQuV3JzXqKkwGp5KU3Y"
}.
{
exp: 1692262142,
iat: 1692258542,
jti: "32620dd7-3dc9-464f-af49-153ba3d389d0",
iss: "https://example.com/realms/domain_acl",
aud: "account",
sub: "46e82311-a784-4c2f-b1ef-057ca127f18b",
typ: "Bearer",
azp: "api-client",
session_state: "e9fbc2b8-b548-423a-8f5a-8469c0a92eb5",
acr: "1",
realm_access: {
roles: [
"******",
"*******"
]
},
resource_access: {
account: {
roles: [
"manage-account",
"manage-account-links",
"view-profile"
]
}
},
scope: "profile email",
sid: "e9fbc2b8-b548-423a-8f5a-8469c0a92eb5",
email_verified: false,
name: "domain ACl",
preferred_username: "dev",
given_name: "domain ACl",
email: "[email protected]"
}.
[signature]


Overview
I tested in Keycloak V22.0.1
Step 1
Create group in your realm
Step 2
Join the group into a user
Step 3
You did the wrong place in
Client scopesYou should be select
profileand map withGroup MembershipStep 4
Get the user access token and display it after decoding
JWTSave as
get-token.jsfile name.Install dependencies
Run it
Result