© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
3 replies
brianb

Sign up with additional user metadata

Heyy, I am working on my project, and it's on Remix (nice react framework). I use supabase for authentication and supabase provides a nice way to signup up users using the email and the password, and there is also another field called "data".

I have a second table called Profiles and whenever a new user signs up, a function is called that will put that info into the new Table, where I can also add custom fields, as opposed to the default Users table provided by supabase.

My question is, how do I actually reference the data in the data field, with postgresql queries?
I haven't found a way to reference it.

Function that runs when a new user joins:
- I want to insert into public.profiles, the info that I receive in the data field sent with the example signup call that I have provided below the sql query.
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
  insert into public.profiles (id, email)
  values (new.id, new.email);
  return new;
end;
$$;

-- trigger the function every time a user is created
drop trigger if exists on_auth_user_created on auth.user;
create trigger on_auth_user_created
  after insert on auth.users
  for each row execute procedure public.handle_new_user();
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer set search_path = public
as $$
begin
  insert into public.profiles (id, email)
  values (new.id, new.email);
  return new;
end;
$$;

-- trigger the function every time a user is created
drop trigger if exists on_auth_user_created on auth.user;
create trigger on_auth_user_created
  after insert on auth.users
  for each row execute procedure public.handle_new_user();



Example auth:
const { user, session, error } = await supabase.auth.signUp(
  {
    email: 'example@email.com',
    password: 'example-password',
  },
  {
    data: {
      first_name: 'John',
      age: 27,
    },
  }
)
const { user, session, error } = await supabase.auth.signUp(
  {
    email: 'example@email.com',
    password: 'example-password',
  },
  {
    data: {
      first_name: 'John',
      age: 27,
    },
  }
)
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Signup with additional metadata
SupabaseSSupabase / help-and-questions
4y ago
user_metadata
SupabaseSSupabase / help-and-questions
4y ago
User Flow (Sign Up , Sign in , Reset/Forgot Password)
SupabaseSSupabase / help-and-questions
2mo ago
Mistake with the sign up
SupabaseSSupabase / help-and-questions
6mo ago