Ken
Ken

Reputation: 31

Vue Supabase no auth

I have a simple supabase DB that I want to be able to show data from within a Vue 3 app without validating the users, anyone can view the page(s) and see the data. There will not be any update/delete pages available as all the necessary data is already in the supabase DB.

Is this possible?

I am very new to Vue and supabase.

Thanks

Ken

Upvotes: 0

Views: 410

Answers (1)

Yes, it is possible to enable all users to view items from a database, but cannot insert/update/delete. In Supabase, there is Row-Level Security, so you can configure whether users can view/insert/update/delete separately.

An example would be this, this enables viewing profiles for everyone, but insert/update/delete is disabled by default.

-- 1. Create table
create table profiles (
  id uuid references auth.users,
  avatar_url text
);

-- 2. Enable RLS
alter table profiles
  enable row level security;

-- 3. Create Policy
create policy "Public profiles are viewable by everyone."
  on profiles for select using (
    true
  );

Upvotes: 2

Related Questions