How to access bucket files with anon key and RLS?

  1. I want to have read access with anon key. But creating a basic policy as below gives me access denied error.
create policy "Read access."
on storage.objects for select using (
    bucket_id = 'bucketname'
    and auth.role() = 'anon'
);

URL - https://xyz.supabase.co/storage/v1/object/sign/bucketname/file.txt?token=anonkey

I am having trouble writing SQL command for it.

  1. Also if I make my bucket public without any RLS, can others only read the documents or can they edit and upload to the bucket?
Was this page helpful?