I have set up keycloak following this guide: https://hub.docker.com/r/jboss/keycloak/ using MySQL as a database. I figured that with attributes additional data can be stored in keycloak and with mappers it is possible to associate the data with clients. My question is, if it is ok (good practice) to store user data, that I want to access later, in keycloak this way? And where the data should be attached to. Since one can attach the attributes to the access token, the id token or the user info. All of which is optional and raises some more questions, which brings me to my second question.
Attributes can change/be added when access tokens were already issued to the user. Meaning, the client won't have immediate access to those attributes via the tokens in use, since the user might still have an older token, where the newly attribute was not attached to. My question is: How does one deal with this? Am I doing something fundamentaly wrong?
I found a related topic: How can I get other users info(username, firstname) by id? [Keycloak]. But this suggests that the client is an admin user or has additional privileges (is a service account).