I can't add user attribute to tokens, guess some caching is happening?

I added a custom attribute to my access token but it is now shown.

  1. user has attribute named birthDate
  2. created a client mapper (UserAttribute)
  3. when I evaluate in Client Scopes, it can be found in the list but when I check the access token, nowhere it is

I did every step on a keycloak I can connect remotely and there it works. Feels like it is caching something. I used the cache buttons at Realm → Caches. Also I deleted the keycloak, installed it again and same. Does keycloak cache somewhere else on a windows?

Thanks in advance.

I couldn’t add user attributes to the token as well.
For me the solution was to use keycloak’s token exchange feature.
More info → Using token exchange - Keycloak

To do so, I had to do the following:

  1. Add features option to keycloak’s build command. Then rebuild/restart keycloak.
kc.sh build --features="token-exchange"
  1. Make a POST keycloak request to /auth/realms/client-id/protocol/openid-connect/token endpoint with grant_type=password in payload.
  2. Get an access token from this request
  3. Make a new request to /auth/realms/client-id/protocol/openid-connect/token endpoint with grant_type=urn:ietf:params:oauth:grant-type:token-exchange and subject_token containing access token from previous request.
  4. Decode token from token exchange to be able to view user attributes.