Use the signed-in user directly in tables and policies.
#Link rows to users
A column with a default of auth.uid() records who created each row:
SQL
user_id uuid not null default auth.uid() references auth.users on delete cascade#Write policies with auth.uid()
SQL
create policy "Users read their own todos" on public.todos
for select to authenticated
using (user_id = auth.uid());#Read token claims
SQL
select auth.jwt() ->> 'email';