getting error 403 `permission denied for table ide...
# help
i
getting error 403
permission denied for table identities
, probably because my RLS policy does a lookup in the identities table. how can I change the RLS policy to let someone lookup their own identity?
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.
i
Copy code
-- 2. Enable RLS
alter table auth.identities
  enable row level security;

-- 3. Create Policy
create policy "Users can lookup their identity."
  on auth.identities for select using (
    user_id = auth.uid()
  );
tried this but still doesn't work
j
Hey I think you might want the users table and the id field?
n
ian_ (2022-05-17)
i
what do you mean?
i need the discord id which is in auth.identities
looks like it is also in auth.users, but in json
j
My bad I misunderstood what you were going for. I saw in a thread somewhere that if your user needs to access data outside of the public schema you should use a trigger to replicate the needed data to a table in public
i
figured it out, needed to add something to the function
n
Thread was archived by @ian_. Anyone can send a message to unarchive it.