I have a google cloud instance with Keycloak installed on it. Keycloak is connected to an external database that contains its tables. I use Keycloak for SSO on multiple applications. Each application has different business logic. In simple words, they’re completely separate.
My problem is that I don’t know what is the best practice for connecting users of the Keycloak database to the database of each app. Should I replicate users in each app, or it’s enough to create rows based on the user ids comes from Keycloak tokens.
In normal behavior, we would have a primary/foreign key relationship between the users table and for example the orders table. But now the users table is in a totally different database. So, what is the correct way to save my data in each app and keep them related to my users in keycloak.