I have been trying to create an RLS policy for a table for contact messages (web app contact form). It should allow anyone to insert (even when not logged in) into the table. I have tried various poilicies but I get an error that RLS policy does not allow insertion of data for users that are not logged in (using Supabase auth). Submission of data when user is logged in works as intended, Here is latest policy I have tried:
CREATE POLICY "anon_can_insert_contact_messages"
ON contact_messages
FOR INSERT
TO anon, authenticated
WITH CHECK (true);
Could anybody please help me with what the RLS policy should be to work as intended?