Supabase Auth Reference to "profiles" not clear to me

Hi,

i have a question regarding Supabase Auth.

Basically like in the WeWeb Tutorial i am updating every users data into Supabase > Tables > auth > raw_user_meta_data

Which works well so far, but how i can make a proper reference in Supabase > Tables > public > profiles
Like for example, someone is updating his profile, it will update first the auth > raw_user_meta_data , after that as well in public > profiles

I would like to have certain inforation beeing as welll updated in the public table.

Do i really need to make 2 querys?

Thanks

You ideally shouldn’t do it like this, that’s why you needed to create a table in the public schema, now that the table profiles is there you update only that one. Otherwise, you’d have to set a database trigger on Supabase’s side, to update the public.profiles record when the auth.users changes, and viceversa :slight_smile:

Generally the Auth table should be used referenced in the public.profiles and you’d do all the public profiles changes in that table, it’s very counterintuitive to do it through meta.

Hi @Broberto , thanks.

But if i update into the profiles table how i can update the auth as well, or is it not necessary?
In that case, i am wondering how i can show properly the users profiles or their settings, whatever, in a private access page. So i will query the profiles table and make in the frontend a coperison between auth id or just using “isAuthenticated”. Because i need somehow to verify that the right information is showing to the right user.

You need to use RLS to filter out who can see what, if that’s your concern. As far as “different data in the auth and profiles” I’d say you need to pick a source of truth. I personally use metadata just if I need to do something while creating the user, after that, I work in the public schema :slight_smile:

Exactlly that was as well my idea, was just not really sure. Thanks for your opinion.