Hey ya'll. Fairly new to supabase, but i'm really ...
# sql
c
Hey ya'll. Fairly new to supabase, but i'm really digging it so far. Small question for setting up policies for my
users
table. I've created a custom auth flow that makes use of ethereum wallet signatures. The user's
id
is basically their wallet address (a string) & is stored in JWT in the
sub
claim. When creating my policy, i'm writing it like so
auth.uid() = address
but I get an error on the supabase UI that looks like this
g
In general user id is expected to be a uuid. If the auth table took your string id then you might be able to create a function like supabase uses to get a string instead. auth.uid() is just a postgres function: create or replace function auth.uid() returns uuid language sql stable as $$ select coalesce( current_setting('request.jwt.claim.sub', true), (current_setting('request.jwt.claims', true)::jsonb ->> 'sub') )::uuid $$;