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:

Hi, I’m building a web app and need to let company admins add users.

New users should be signed up using Supabase’s workflow, including confirmation emails, with a company ID added to their profile. Users may have multiple company IDs assigned.

If a user already exists, only the company ID should be added.

What’s the best approach for this? Should I use metadata, a PostgreSQL function, or something else?

I think this requires a more sophisticated solution, because it is a big thing to have multiple tenant groups with multiple user roles, especially if you want to keep it performant and scalable. If you want, I do 1:1 consulting where I look at ylur guys’ projects a little more in depth.

Thanks for the reply. I’m going to have to rethink my approach, it seems Supabase auth does not support multi-tenant yet.

Supabase does in-fact support multi-tenant auth! :smile: It’s a little bit of a setup but 100% doable. Definitely get with @Broberto, he was able to help me out with the same situation.