Fibrasek
01/05/2022, 1:31 PMrecipes
table with a foreign key named user_id
that is related to users.uid
. Then I created a policy on top of recipes
for users to be able to se only what they have created, so I wrote (auth.uid() = user_id)
. The problem is I can't see anything in my app and the queries always return RLS policy error :/silentworks
01/05/2022, 2:35 PMuser_id
column inside of the recipes
table is actually populatedFibrasek
01/05/2022, 2:39 PMsilentworks
01/05/2022, 2:40 PMFibrasek
01/05/2022, 2:40 PMFibrasek
01/05/2022, 2:42 PMFibrasek
01/05/2022, 2:42 PMFibrasek
01/05/2022, 2:43 PMFibrasek
01/05/2022, 2:44 PMFibrasek
01/05/2022, 2:45 PMFibrasek
01/05/2022, 2:47 PMimport { createClient } from '@supabase/supabase-js'
const supabase = createClient(
import.meta.env.VITE_SUPABASE_URL,
import.meta.env.VITE_SUPABASE_ANON_KEY
)
export const getAll = async (table) => {
const { data, error } = await supabase
.from(table)
.select('*');
if (error) {
console.log(error);
return false;
} else {
return data;
}
}
silentworks
01/05/2022, 2:55 PMselect * from pg_policies
to view all policiessilentworks
01/05/2022, 2:55 PMFibrasek
01/05/2022, 2:59 PMFibrasek
01/05/2022, 3:32 PMFibrasek
01/05/2022, 3:33 PMsilentworks
01/05/2022, 4:10 PMsilentworks
01/05/2022, 4:12 PMsilentworks
01/05/2022, 4:13 PMFibrasek
01/05/2022, 4:13 PMFibrasek
01/05/2022, 4:13 PMFibrasek
01/05/2022, 4:14 PMsilentworks
01/05/2022, 4:14 PMFibrasek
01/05/2022, 4:14 PM