Keycloack jwt configuration - how to hide or omit resource_access of jwt token

Viewed 1706

I want to be able to generate a JWT token which does NOT include the resource_access property using the simple api login method.

The usecase is that I want to generate an offline token and store it on an nfc chip for long term usage. The resource_access however "bloats" up the token since we have lots of different roles. This causes the reading prozess to take forever.

2 Answers

Try to configure used OIDC client in the Keycloak. Remove roles from Assigned Default Client Scopes.

Try the following:

Go to Client Scopes > roles > Mappers > client roles

Then deselect "Add to ID token".

This should ideally remove "resource_access" section from JWT

Related