Hi, any doc reference or clue on multi schema hand...
# talk-kratos
g
Hi, any doc reference or clue on multi schema handling, let’s say in registration flow, for different user types?
p
Hi @glamorous-parrot-72599 This is currently not possible, see https://github.com/ory/kratos/issues/765
It would probably be best to have multiple kratos instances which is picked based on sign in domain or organisation etc.
g
@nutritious-keyboard-66791
n
@proud-plumber-24205 Does this applies to Ory Network also? (we’re doing PoC currently w. Ory Network)
p
Yes this also applies to the Ory Network unfortunately. What is your use case, maybe I can assist to find a solution?
n
We have need to have different schemas(eg.): • Employees • Employers
Our webUI for employers should have self-service UI (login, registration, etc.) and use
employers
-schema.
p
Is it because the traits are different?
n
Yes
Employees use mobile app and they should have also self-service UI
p
That's fine, you can use a singular schema and then add permissions to each using their unique ID assigned by Kratos. Find common traits to store in the schema and the rest you store inside your own database.
Permissions are separate from the Identity schema https://www.ory.sh/docs/keto/
The other solution is to use two Ory projects with their own schema's respectively issuing cookies on the same TLD
n
We’re still learning ory permissions. Not sure how easy the permission handling is if we have over 300k users and roughly 40k companies.
Ok. Perhaps the singular schema is doable in our case 🤔
p
@glamorous-parrot-72599 I think we have community contributed examples here: https://github.com/ory/examples/tree/master/kratos-keto-oathkeeper-k8s But to be honest, this is more extensive topic within your own systems architecture. Ory just provides the services for Authentication and Authorization. A basic implementation would be: 1. User signs up (Ory Identity / Kratos) 2. A webhook fires calling your service with the Identity ID 3. Your service stores this information and creates the necessary permissions using Ory Permissions / Keto 4. Later the user calls your service with a session cookie - the cookie contains their userID 5. The userID is used with the object you are protecting (e.g. files) to call Ory permissions check API. Based on response you allow or deny. Please take a look at the permissions document https://www.ory.sh/docs/keto/
In your case, since you want employees and employers, you might create these users using the Admin API instead, and then just send out recovery links https://www.ory.sh/docs/kratos/manage-identities/create-users-identities
We also provide a way to set meta-data on the identity. https://www.ory.sh/docs/kratos/manage-identities/managing-users-identities-metadata
d
@proud-plumber-24205 I am using
code
strategy and sending the recovery link, but users are not able to complete flow because of missing csrf_token how do I handle this.