:wave: I am so new on json schemas and also tryin...
# talk-kratos
l
đź‘‹ I am so new on json schemas and also trying to understand how it actually works with kratos. So i have a project in mind where there will be user profile information. not only registration related info. So my question(s) is probably relatively simple. 1. would kratos be the place to store that info in? 2. will the db (postgres) be populated with the fields defined in the json schema? Or would I need to write my own backend for that and then map my user to kratos user id?
a
I am also looking into this currently. I think the best way would be to save only authentication relevant information into the traits of the identity in kratos. I also would create an user before creating the identity and then add the userId to the traits.
Btw. I do not think that you can use the frontend api for that. Instead you have to use the admin api. Do not pin me down on that one since I am also new and trying to figure it out. At least I managed to create this the way like I mentioned it.
l
🤔 i am still curious. Why would I want to create my user before the identity? 🤔
m
Hello @acoustic-shampoo-32095 @loud-helmet-81363
I think the best way would be to save only authentication relevant information into the traits of the identity in kratos.
Definitely! This is because while you can get data from Ory, it is much more efficient to have business logic in your db where you can do proper database operations. If you want the user to create the identity in self-service you would use the frontend API. If you want to create the identity and “invite” the user, then admin API and recovery flow.
Why would I want to create my user before the identity?
I think in Alis case he wants to create a userID beforehand in his database and then use that in the Ory identity. Another way could be to use Ory Actions webhooks to add the userID as metadata to the identity, but both are fine!
l
so @magnificent-energy-493 It's recommended by, Ory to store all your own information you need in your app in your own DB? Then I would need to use the admin API to communicate from Kratos to my own app (bidirectional) ? No need to update traits etc with json schema for Kratos to store my user profile data there? E.g. birthday or other info i might want from a user after they have created an identity
simply KISS on Kratos.
m
Yea most simple IMO would be • only authentication related data in Ory identity schema • use UUID from Ory to relate identity to the on in your app database • all info needed for business logic is stored outside of Ory You wouldn’t need the admin API, just use Ory Actions to create/update your DB record when there are changes in Ory; and to fetch the user data required (e.g. the UUID to get info from db) you call /whoami from the user app/browser when logged in. Does that sound like it makes sense?
l
yup
c
@loud-helmet-81363
Copy code
I want to create my user before the identity? :thinking_face:
imagine you are a doctors office, someone new calls for an appointment, you set them up a profile(user) and then a link to complete their setup
dont know how to reply
l
ya, that makes sense in that case 🙂