Update ID Token

When a user logs in (through Keycloak, with OpenID Connect using the authorization code flow), Keycloak creates an ID token and stores it as a JWT in a cookie.

Now, let’s suppose while the user is already logged in, he/she changes some data like his/her phone number which also happens to be stored in the ID Token.
This data is changed outside Keycloak and eventually changed in Keycloak’s database. After this update is performed, if the user logs out and logs in again, the ID token is updated with the new data (a phone number in this particular case).

Now, is there a way update the ID token with the new data, without requiring to logout and login again?

Thank you very much for your help!

One easy solution could be to use the Refresh Token to obtain new tokens.

And you can also call the userinfo endpoint which will returns the updated claims about the authenticated user.
You can specify which claims will appear in the ID Token and/or the userinfo endpoint.

1 Like