Sign Up with Additional Data
I have a question about the provided sign up capabilities within Better Auth.
I have a use case where I need to collect additional data about the user on sign up for my application (e.g. their address). What’s the expectation on managing that requirement with Better Auth? Do I mutate the provided User table generated by BA? Or do I create a separate database table that joins on the user table via userId? That path also comes with the implication of creating a separate API call to also write to that separate table after doing the sign up API call.
Just curious what best practices are in this kind of situation.
2 Replies
Theres the
additionalFields
feature that you can use for that. https://www.better-auth.com/docs/concepts/database#extending-core-schemaDatabase | Better Auth
Learn how to use a database with Better Auth.
Social sign up is usually a problem to figure out how you are going to get the data into that, at our place we went with adding the fields optionally and then require the user to fill all missing details after signing up
You'd probably need to check if the user went through the onboarding process whenever you need access to those infos, but apart from that, this is the intended way