# Supabase Creating User Profile

**URL:** <https://community.weweb.io/t/supabase-creating-user-profile/2002>\
**Category:** Ask us anything\
**Tags:** supabase\
**Created:** [March 8, 2023, 10:06pm UTC](https://community.weweb.io/t/supabase-creating-user-profile/2002 "2023-03-08T22:06:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@Erik](https://community.weweb.io/u/Erik)\
**Post date:** [March 8, 2023, 10:06pm UTC](https://community.weweb.io/t/supabase-creating-user-profile/2002/1 "2023-03-08T22:06:52Z")

</div>

Hey everyone,

I’m testing a supabase x weweb integration.

When a user signs up, I want to create a corresponding profile for them in a separate (public) table. I’m running into two issues, first it seems like the user object isn’t being returned. That’s preventing me from creating the profile with the same uuid as the auth table.

Any advice getting past this? Seems really simple but I haven’t found a solution.

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [March 9, 2023, 9:20am UTC](https://community.weweb.io/t/supabase-creating-user-profile/2002/2 "2023-03-09T09:20:40Z")

</div>

Best advice is to do this on supabase side.  
If I remember correctly they have a template or an example of exactly this usecase.  
This is what i have i my personal project

You need to create a function handle\_new\_user (Database \> Functions)  
This is what mine is looking like

```auto
begin
  insert into public.profiles (id)
  values (new.id);
  return new;
end;

```

Then you can use this function on a trigger

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/dca2f579b10917315c9df2707c674e80f3eae3f4.png)

---

<div class="post-metadata">

**Author:** ![Matthieu](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/matthieu/32/1288_2.png) [@Matthieu](https://community.weweb.io/u/Matthieu)\
**Post date:** [March 9, 2023, 10:02am UTC](https://community.weweb.io/t/supabase-creating-user-profile/2002/3 "2023-03-09T10:02:01Z")

</div>

That’s exactly what I do.  
Trigger after insert into auth.users \> execute function  
Be careful when setting all this, you have to dive into the advanced settings to allow your function to do it’s business. Security Definer is the option you should look for.

Have a nice day.

Matth-
