Adding additional fields to user signup

So I have successfully setup my user signup form using Supabase authentication. Im using Mailgun to send emails which works as well as i receive the email to verify the account.

From what I can tell there is an auth collection that is set as private within Supabase. This is really where my struggle starts. So by default the setup is created with email and password. Other than created dates etc. that are populated by Supabase there’s not much i can add that im aware of.

During account creation I’d ideally like to populate a collection with first name, last name as the start of a user profile that could be completed later but first and last name would be a good start. As an added bonus collecting the company name to populate a company profile collection would be nice as well.

I feel like during the account setup workflow i should be able to add multiple steps but im not sure how to go about it. Something like

  1. Create user with email and password.
  2. Return created user id
  3. Add first name and last name with user id to the user profile table
  4. Obtain user profile id from last step
  5. Creat company name in company table and add user id/profile id although user id maybe sufficient.

Am i way off on this logic or is there a better way to do this?

1 Like

Hello, that’s what the user_app_metadata is for in Supabase. You can add all these fields (or even some custom ones) by using the Metadata option when Signing up a user. Simple as that :slight_smile:

From there you would create a trigger, as also Supabase and many other suggests, that would automatically, on account creation, create a record in profiles table, with the auth.id and the demographics of your choice.

So you can automate the steps 1. - 4. and you’ll only need to create the Account and the Company. I do these kinds of setups for people if you’d be interested :slight_smile: