hey - really in need of help. how do I access auth...
# help
i
hey - really in need of help. how do I access auth.identities from supabasejs? i'm using the service role.
n
Hello @ian_! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
You need to either use an rpc security definer function, or make a public table copy using a trigger on the auth.identities table .
n
ian_ (2022-06-04)
i
how do I do that?
how can I just give the service_role key perms to see the auth.identities table
also how would I query it, because supabasejs from() expects a table in
public
g
I don't think you can change the service_role permission to solve it. The interface (PostgREST thru supabase-js) only handles one schema at a time (default public) and I don't think there is (at least in the dashboard) a way to set it to use auth schema (for security reasons). So you make your rpc call in the client to the security definer function (check the role is service_role in that if you want) and make your selects and return result. Or do an insert (update?) trigger on auth.identities to update your own public table.
i
ok, thank you
@garyaustin a similar way to do it would be to store the discord ID in the table that I need it, but I can't seem to
select id from auth.identities
within an RLS policy. how can I do that?
it's a permission error
g
I've not really messed with directly accessing the auth schema except thru security definer functions. RLS policies are run as the API user so would not have access.
i
thanks. I figured it out and will write a little github gist for anyone confused in the future :)